Caveat: I’m doing this from memory, as I can’t access the command line on my PC at work.
Start > Run > cmd > Enter
In the command line window, go to the parent folder of where you want to start deleting from subfolders. (For example, if you want to delete files in the folders below “c:\foo\bar” type “cd \foo\bar” (no quotes) and press Enter.
Now type “dir /b > macro.bat” (no quotes) and press Enter. This will create a text file called “macro.bat” which you will now edit as follows:
For every line in the text file that looks like “smith,” edit it to read “echo y|del smith*.*” (no quotes, the | character is on the \ key). This goes quickly with copy and paste. Delete any extraneous lines the the file (lines which are not the names of directories.)
Exit the editor you’re using (notepad or whatever) and save the file under its original name. Return to the command line window and type “macro” and press Enter to run the batch file.
If those folders are scattered all over, I can’t help.
But if they are all subfolders of one master folder, and there are no exceptions (you want to delete ALL these files and NONE of the folders), here’s how to do it:
[ol]
[li]Go to that master folder in My Computer, or Windows Explorer.[/li][li]Do a Search to find all files, with no criteria. This will produce a list of all the files AND folders.[/li][li]Go to the column titled “File Type”, and click on it. Your results are now sorted by file type. You don’t really care about the file type, but this is an effective way of separating the Folders from the Files. The list will begin with all your folders and subfolders. (If not, then they got reverse-sorted; click on File Type again to set it right.)[/li][li]Scroll down past the folders, and click on whichever is the first file you see.[/li][li]Scroll to the very end, and hold down the Shift Key while clicking on the last file.[/li][li]You have now selected all the Files, and none of the Folders. Scroll back up to be sure.[/li][li]Press DEL.[/li][/ol]
Unlike the posts above, this procedure has the advantage of not needing any programming knowledge. Plus, it lets you double-check the selections before deleting them.
No (no no no no), the DEL command only deletes files. JerseyFrank’s method would have worked, though the syntax was slightly off.
del "c:\YourRootDirectory" /S /F /Q
will silently delete all files under c:\YourRootDirectory and any of its subfolders, but will not delete the folders themselves. For that you need the RD command.
Perhaps you were thinking of DELTREE. It was available in Win9x, but its functionality has been merged into RD.