Remove folder contained in different folders

34 Views Asked by At

I solved a similar issue thanks to other user, but not works for folder. I have these folders: C:\Users\ge-15\documents\private C:\Users\te-98\documents\private C:\Users\ma-98\documents\private C:\Users\ge-12\documents\private C:\Users\vr-88\documents\private

I need to delete all the files and folders contained in private folders but only for the users that the name starts with GE (so in this case only for the users ge-15 and ge-12) I can't find any solution...

Thanks to all can help me. Regards

The following command works for file (del command) but I cannot find any solution for the folders. for /D %%I in ("C:\Users\ge*") do del /A /F /Q "%%I\documents\private\*" 2>nul For the folders I tried this: for /D /R %%I in ("C:\Users\ge*") do rmdir /S /Q "%%I\documents\private\*" 2>nul without luck...

0

There are 0 best solutions below