I am trying to do some recursive work for processing images etc, they get copied into a new folder. I only specify the root folder of the input files and there is a whole tree of folders and images inside. If I run the below code, the images all gets copied into the same folder. I.e. they loose the tree-of-folders. Most of these images have the same name, thus it conflicts copying them into a single folder.
This is what I use thats doing the above mentioned:
FOR /R "./New" %f IN (*.png) DO (pngcrush -brute -d /ProcessedTiles %f %f)
This takes all my PNG's in ./New
, process them and then add the images 开发者_运维百科to /ProcessedTiles
on my C://
drive. Very convenient and works well.
Inside ./New
there are many directories such as ./New/5/9
with two images in etc. What I want is to be able to get the file from there (./New/5/9/25.png
) and when converted have is saved at /ProcessedTiles/5/6/25.png
instead of the ./ProcessedTiles/25.png
which I get now.
So is there a command line command similar to this:
FOR /R "./New" %f IN (*.png) DO (pngcrush -brute -d /ProcessedTiles %f "(%f's directory)+%f")
Thank you
精彩评论