简体   繁体   中英

Windows CMD delete directory

I'm in D:\\User Profiles\\ and I need to delete directorys located in

D:\User Profiles\---USERNAME---\UPM_Profile\AppData\Local\Mozilla\Firefox\Profiles\*.default

Now here's the question. How can I do this dynamic ? If I type

dir /ad /b /s D:\User Profiles\*\UPM_Profile\AppData\Local\Mozilla\Firefox\Profiles\*.default

it fails. ---USERNAME--- and *.default needs to be dynamic. Any ideas `?

Something like:

@echo off
for /d %%i in ("D:\User Profiles\*") do (
   call :remove_dirs %%i
)
goto :eof

:remove_dirs
  echo %1
  for /d %%j in ("%1\UPM_Profile\AppData\Local\Mozilla\Firefox\Profiles") do rmdir %%j
  goto :eof

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM