Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

windows how to delete a file in all subfolders

:: to delete the file named 'foo.txt' from all subdirectories of the current 
:: working directory
:: run this command in the windows cmd.exe shell:
for /f %f in ('dir /d /b') do del /s /q %ffoo.txt

:: if 'foo' is a directory, the previous command merely empties the directory
:: to clean up and remove the empty foo directories afterwards run this command
for /f %f in ('dir /d /b') do rd /s /q %ffoo
 
PREVIOUS NEXT
Tagged: #windows #delete #file #subfolders
ADD COMMENT
Topic
Name
5+3 =