I’m trying find a way to delete a specific folder name and delete all of its contents in Windows. So my D: drive has a 100 folders, inside each of these folders are sub folders called folder1, folder2, folder3, etc. I want to be able to run a command at the root of D: that will search through each 100 folders and delete say folder3, and folder9 and all of its contents.
RD /s /q "folder1"
The above command doesnt like to search through subdirectories.
Anyway of doing with with CMD or do I need a .vbs script or something?
Thanks!
You can use the
FORcommand to go through the list of subfolders from a given location and run commands on each subfolder. e.g.:It would get the list of folders in someFolder, and delete the directories named “folder1” and “folder3” from each subfolder.