PDA

View Full Version : Rename multiple files?


RapD
08-22-2005, 12:23 PM
How can i rename a multiple files in 1 folder to one name?

I was try to use in this command:
File.Rename("AutoPlay\\Images\\*.jpg", "AutoPlay\\Images\\name.jpg");
But its dont works.

TJ_Tigger
08-22-2005, 02:22 PM
I don't understand what it is you are trying to do here. Are you wanting to rename all the files in a particular location to a common name/numbering scheme. The way your question is worded it seems like you want to take all .jpg files and rename them all "name.jpg", which would in effect only leave you with one file named name.jpg, the last one.

You can use File.Find to fine all the .jpg files in a directory, this returns a table of all the files.

tFiles = File.Find(details here)

You can then use a for loop to go through eacy item and rename them the way you want.

for i,v in tFiles do
File.Rename(v, "path\\name"..i..".jpg")
end

HTH
Tigg