Let's assume that I have a bunch of unwanted ".tmp" files in the sub-directory "subdir". The directory "subdir" also has other sub-directories containing more files that I would like to delete.
For those of you familiar with Linux, to find and delete files its as easy as the following command:
find ./subdir/ -name '*.tmp'-exec rm -f {} \;
Unfortunately, I couldn't muster something like that up on Windows Vista. I tried stuff likedir /B /S | find ".tmp"This produced the full path of the files that I no longer wanted. When I then tried to pipe those files to del, like
dir /B /S | find ".tmp" | delVista just said 'The syntax of the command is incorrect.'
To make a long story short, I was finally able to come up with the following:
for /R %i in ("*.tmp") do del %iDo you have an alternative way of finding and deleting files?
No comments:
Post a Comment