Delete file and folder under path with wildcard
Posted: 23 Jul 2023 07:37
Hi all, I have this issue and don't found any solution... (I worked on it all the last week without lucky)
I have a structure like this:
C:\Users\UT45\AppData\Logs\
C:\Users\CR45\AppData\Logs\
C:\Users\UT45\AppData\Logs\
I need to delete all the file and folder under Logs folder, but only for the user which username starts with: UT*
This command works for all the file, but not for the folder:
I hope I can find help here...
Thank you to all, have a nice day!
I have a structure like this:
C:\Users\UT45\AppData\Logs\
C:\Users\CR45\AppData\Logs\
C:\Users\UT45\AppData\Logs\
I need to delete all the file and folder under Logs folder, but only for the user which username starts with: UT*
This command works for all the file, but not for the folder:
Code: Select all
for /D %%I in ("C:\Users\UT*") do del /A /F /Q "%%I\AppData\Logs\*" 2>nul
Thank you to all, have a nice day!