rename series of files using excel list?
HI!
I have a series of file.jpg,
I have to rename using a series of names present in an excel column, is it possible?
HI!
I have a series of file.jpg,
I have to rename using a series of names present in an excel column, is it possible?
Ok, this is a VERY basic routine to read in a tab-delimited list of files with old name <tab> new name format and rename files in the current folder.
You would need to run it from ESTK or VS Code, or write a wrapper to load it in Bridge and run it via menu. There is no error checking (for illegal filenames and such) and it will happily cause problems with duplicate filenames.
Feel free to use it in your own script. I don't have time at the moment to neaten it up.
try{
var renFile = new File('~/Desktop').openDlg('Select Naming Pairs File', '*.txt'); //select naming pairs file
if(renFile != null){ //open and read in terms file
renFile.open('r');
var i = 0;
var renList = [];
var renLine = renFile.readln();
while(renLine != ''){ //read in search terms one line at a time, place in array
renList[i] = renLine;
renLine = renFile.readln();
i = i + 1;
}
renFile.close();
}
var renParam = [];
var renFolder = app.document.presentationPath; //current folder
for(var j = 0; j < renList.length; j++){
renParam = renList[j].split('\t'); //split old and new names
if(renParam[0] != '' && renParam[1] != ''){ //both specified
var renTarget = new Thumbnail(renFolder + '\\' + renParam[0]); //find file
renTarget.name = (renParam[1]); //rename
}
}
}
catch(e){ //oops
alert(e + ' ' + e.line);
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.