views:

40

answers:

1

I have a folder structure with one main parent folder containing many subfolders, and in these some PNGs, something like:

.../data

.../data/013523/
.../data/345343/
.../data/395338/

.../data/013523/filex.png
.../data/013523/filey.png
.../data/345343/filea.png
.../data/345343/fileb.png
.../data/345343/filec.png

I'd like to crush all these PNGs with a Windows batch-script knowing only the location of the parent data folder (ie the folder names and png names are unknown, it should just crush all PNGs in all folders).

I took a look at http://stackoverflow.com/questions/1243240/drag-and-drop-batch-file-for-multiple-files but this didn't seem to be quite what I was after.

Oh and no fancy naming options required, crushing in-place is fine.

+1  A: 

Well

for /r ...\data %%x in (*.png) do pngcrush "%%x"

should do it.

If the path to your data directory contains spaces somewhere, the following should work better, though:

pushd "...\data"
for /r %%x in (*.png) do pngcrush "%%x"
popd
Joey
Thanks will try it out shortly.
Joseph Earl
Thank you very much, it worked perfectly!
Joseph Earl