Saturday, October 13, 2018

windows - Bulk rename files to name of parent folder

I have a large (aprox. 150,000) tiff files which all have the same filename. They are unique because of the directory structure they are held in.


I would like to bulk rename the tiff files so they become unique, based on the directory structre that they are held within.


Does anyone have any method of acheiving this?


I am using Windows Server 2012 so a solution using a cmd script, batch file or windows GUI tool would be perfect.


Ideally, this is what I would like to acheieve, but if I have to have more or all of the directory structure in the final filename thsi would still be very, very helpful.



C:\A_001\B_0001\ABC\0001.tif -> ABC.tif


C:\A_001\B_0001\JKL:\0001.tif -> JKL.tif


C:\A_001\B_0001\XYZ\0001.tif -> XYZ.tif


C:\A_001\B_0002\123\0001.tif -> 123.tif


C:\A_001\B_0002\456\0001.tif -> 456.tif


C:\A_001\B_0002\789\0001.tif -> 789.tif


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...