Answer the question
In order to leave comments, you need to log in
Windows batch find and delete?
find /some/path -type d -name .svn -delete<br/>
find /some/path -type d -name "Prefix_*" -delete<br/>
find /some/path -type f -name "*.bak" -delete<br/>
for /?
it gives little information)for /R "D:\SomePath" %X in (*.bak) do (del "%X")
Answer the question
In order to leave comments, you need to log in
find /some/path -type d -name .svn -delete
for /D /R "D:\SomePath" %X in (svn) do (rmdir /Q /S "%X")
find /some/path -type d -name "Prefix_*" -delete
for /D /R "D:\SomePath" %X in (Prefix_*) do (rmdir /Q /S "%X")
From the documentation [1] on for
Directories only
If set contains wildcards (* and ?), the specified command executes for each directory (instead of a set of files in a specified directory) that matches set. The syntax is:
for /D {%% | %}variable in (set) do command [CommandLineOptions]
[1] technet.microsoft.com/en-us/library/bb490909.aspx
in general, windows has a built-in find, but it looks more like a simplified grep. Maybe it will be enough for the task, here more experienced win-comrades should suggest.
Can you try power shell? Well, or install cygwin and use the usual Linux commands and scripts.
And there is also such a thing called cygwin - I advise you to take a closer look.
Personally, I would implement the task in WSH (Jscript / VBscript) - the language is much more powerful there, incl. you want to be available through the Enumerator collection.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question