Created a script that on a windows environment using the 'Rename' method can also change the path / location of the file where on OSx enviroment it fails
So on OSx I've tried the changePath method all i get is a folder created of the file name. Any incite would be fantastic .
The script below is a sample it does read a tab text file to get source and destination names - but the piece at the end of changePath and rename both fail on OSx - i've run this in photoshop,extendscript,indesign and works on windows.
var textFile = File.openDialog ("Open Data Excel Sheet", "*.txt,*.csv",false);
var imageDir = Folder.selectDialog("Select Source Directory");
var destinationDir = Folder.selectDialog("Select Destination");
var line = 0;
var articleColumn = 7;
var upcColumn= 9;
var filetype = "*.tif";
var upctoart = [];
if(textFile != null && imageDir != null && destinationDir != null){
textFile.open('r');
while(!textFile.eof)
{
var row = textFile.readln();
var cols = row.split("\t");
upctoart[cols[upcColumn]]=cols[articleColumn];
/*if(line == 25)
{
alert(cols[upcColumn] + '----' + cols[articleColumn]);
}*/
line++;
}
textFile.close();
var files = imageDir.getFiles(filetype);
for(var i = 0; i < files.length; i++)
{
//alert (files[i].fullName);
var f = files[i];
var fileName = f.name;
var fs = fileName.split("_");
if(typeof upctoart[fs[0]] == 'undefined')
{
continue;
}
var artNum = upctoart[fs[0]];
var destinationFileName = fileName.replace(fs[0],artNum);
try{
f.rename(destinationFileName);
f.changePath (destinationDir.fullName + '/');
}catch(err){}
}
}
alert('Done');