rd, rmdir, del what to use

283 views Asked by At

Situation:

x:\neededmap\files.txt
x:\neededmap\trashmap1\files.txt
x:\neededmap\trashmap1\trashmap2\files.txt
x:\neededmap\trashmap3\files.txt
x:\neededmap\trashmap4\files.txt

How to delete by batch all Files.txt and all trashmaps Or better, just the neededmap must remain.

1

There are 1 answers

0
David Moruzzi On

You may do this through del /f /s /q files.txt - this will delete all files.txt from the current working directory (CWD) and all subsequent directories. Please use caution.

Microsoft provides excellent documentation on their Del references page. The /f forces deletion of read-only files, the /s is equivalent to -recurse in Powershell. The /q makes it execute quietly and not request for confirmation.