Recursively Delete File Types From A Named Folder Only
Posted: 10 Jun 2020 14:20
I have a weekly cleanup routine I want to setup where I scan an entire directory of users folders and delete file types *.psr and *.zip but only in certain folders. Not every sub-folder.
Each user's folder in this directory has a sub-folder named the exact same name for all users. I only want to delete these files in the named sub-folder of each user. In the screen shot example below it would be the Target-Folder. The Target-Folder name exists for all users.
I came up with this Del statement to run and it works but deletes those file types from all sub-folders and not just the Target-Folder for each user.
DEL /S /Q *.psr *.zip > Deleted-psr-zip.txt 2>&1
This is a network file share server so I can't run powershell. I would like to use cmd's from a batch file.
Thanks,
Pmc181
Each user's folder in this directory has a sub-folder named the exact same name for all users. I only want to delete these files in the named sub-folder of each user. In the screen shot example below it would be the Target-Folder. The Target-Folder name exists for all users.
I came up with this Del statement to run and it works but deletes those file types from all sub-folders and not just the Target-Folder for each user.
DEL /S /Q *.psr *.zip > Deleted-psr-zip.txt 2>&1
This is a network file share server so I can't run powershell. I would like to use cmd's from a batch file.
Thanks,
Pmc181