Batch Script

hijack87

n00b
Joined
Jan 19, 2011
Messages
1
Needing a batch script that will delete all files with a specific extension throughout all folders. I have a couple scripts that will do this for the folder in which it is place and subfolders. I've tried changing the directory to the C:\ and also to C:\Documents and Settings\ in hopes that it would work, but to no avail.

The scripts that I have use are:

pushd %0\..
for /r %%i in (*.jpg) do if not exist "%%~dpni.cr2" del "%%~dpni.jpg"
popd

as well as:

attrib +h folder.jpg /s
del *.jpg /s
attrib -h folder.jpg /s

I realize that these are doing specific things but I did modify them to suit my needs.

Also, I know I could use the windows search function for this, but I have something specific in mind. Appreciate any help in advance.
 
Disclaimer: I'm not a batch expert.

But you might try replacing your *.jpg with something like

'dir *.jpg /b /od /s'

which should give you a big list of files to for-in.
 
Back
Top