Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename files in multiple folders with increment

Status
Not open for further replies.

user69

Technical User
Jun 30, 2004
2
GB
Hello, I am hoping to find a script that will allow the following to be completed:

Look in multiple subfolders at the files contained within, query the filename to see if it meets a certain naming convention eg filename%.ext, if a file does not meet the convention then rename it with an incremented number that is 1 value higher than the file with the highest number in that folder... Eg:

Root folder: C:\test
Look in all subfolders: C:\test\sub1, C:\test\sub2, C:\test\sub3 etc
Query existing files: So if 'filename1.ext', 'filename2.ext' exist leave as they are, but if 'filenameotherdif.ext' exists then rename it to 'filename3.ext' (the 3 value being 1 greater than the last filename in the folder with the correct convention.

I hope that makes sense?
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top