Computer Science Canada

Mass File Renaming

Author:  romantic_programmer [ Mon Dec 15, 2008 2:50 am ]
Post subject:  Mass File Renaming

Problem: I have several thousand photos with in an array of folders. i am looking for help to design a program that will allow me to rename the files one folder at a time. So just say all the files in folder A are random numbers. i would like to take this folder and change all the file names to birthdayparty(*)

* = a increment number to prevent duplicate file nameing

I am just having a problem on how to start it.... i know i need to use the File manipulation module, and maybe a few for statements or loops...

if someone could help me in the right direction this would be a huge time saver.

ok i edited this message and so far this is what i have come up with...


code:
/*
* Must place this file into the Directory in
* which you wants it's files to be rewritten
*/

var inc : int := 0
var newName : string := ""
var genericFile : string

put "Welcome, to your file name changer"
loop
File.Rename ("\""+ genericFile + "\"" + ".jpg", "\""+ newName + "\"" + inc + ".jpg")
inc += 1
end loop
put Error.LastMsg

Author:  [Gandalf] [ Mon Dec 15, 2008 2:06 pm ]
Post subject:  RE:Mass File Renaming

Look up Dir.Open() Dir.Get() and of course Dir.Close(), those should give you everything necessary to finish your program.


: