Hi Folks,
Let me just say this, so I can get it off my chest ... Adobe why on earth did you make these forums the most maddeningly formatted I have ever used. Not intuitive at all and needlessly complicated and precious. I thought you guys were good at this stuff?
Whew ...
I have about 50,000 raw files all rated, labeled and keyworded. They are in about 450 folders but the numbering of the files is just whatever my particular Canon camera of the day had at the time. I'd like to change the filenames to my initial and last name, date (YR,MONTH,DAY), a number from 0001-9999 (for that particular date) and a two letter suffix.
For instance:
fguy_120109_0001_SF.CR2
The question is, is there some way to automate this without having to go to each folder separately, select all the files and rename? Can this be automated? Otherwise thats 450 folders to deal with.
Suggestions please.
Learning to script is not something thats done overnight… Well for me it was/isn't… If you require lots of scripted solutions its worth while it can save you lots of time but theres a learning curve… If this is your only need then someone may help but you would need to supply more details… I don't have CS6 but that may or may not be a problem… What OS are you using and where are the folders all in the same directory?
Hello, I've put bridge as the script target for this although it isn't actually using Bridge scripting commands… Give it a try on a smaller selection and see if it works… I only tested with 4 folders of a dozen files each looks pretty close to what you asked although date is vauge… Created date, modified date todays date?
#target bridge
reNameFiles();
function reNameFiles() {
var top = Folder.selectDialog( 'Please select the top level folder' );
if ( top != null ) {
var crFiles, folders, countA, countB, i, j, date, newName;
folders = top.getFiles();
countA = folders.length;
for ( i = 0; i < countA; i++ ) {
if ( folders[i] instanceof Folder ) {
crFiles = folders[i].getFiles( /\.CR2$/i );
countB = crFiles.length;
for ( j = 0; j < countB; j++ ) {
date = '120109_'; // You may need to change this…??????
newName = 'fguy_' + date + zeroPad( j, 4 ) + '_SF.CR2';
crFiles[j].rename( newName );
};
};
};
};
};
function zeroPad( n, p ) {
var t = n.toString();
while ( t.length < p ) { t = '0' + t };
return t;
};
Was pottering about so I put some date options in and fixed my zero error…
#target bridge
reNameFiles();
function reNameFiles() {
var top = Folder.selectDialog( 'Please select the top level folder' );
if ( top != null ) {
var crFiles, folders, countA, countB, i, j, date, newName;
folders = top.getFiles();
countA = folders.length;
for ( i = 0; i < countA; i++ ) {
if ( folders[i] instanceof Folder ) {
crFiles = folders[i].getFiles( /\.CR2$/i );
countB = crFiles.length;
for ( j = 0; j < countB; j++ ) {
//date = '120109'; // A hard coded String Date…
date = new Date(); // Today's Date
//date = crFiles[j].modified; // File Modified Date
//date = crFiles[j].created; // File Created Date
date = getDateYYMMDD( date );
newName = 'fguy_' + date + '_' + zeroPad( j+1, 4 ) + '_SF.CR2';
crFiles[j].rename( newName );
};
};
};
};
};
function zeroPad( n, p ) {
var t = n.toString();
while ( t.length < p ) { t = '0' + t };
return t;
};
function getDateYYMMDD( d ) {
var yy = String( d.getFullYear() ).substring( 2, 4 );
var mm = d.getMonth() + 1;
if ( mm < 10 ) { mm = '0' + mm };
var dd = d.getDate();
if ( dd < 10 ) { dd = '0' + dd };
return yy + mm + dd;
};
Hi Mark,
Thanks so much for creating the script. As you probably imagined, fguy (FiveOGuy) isn't my real name, I'll probably change the "SF" suffix as well. I can see where those are added in the script so I imaging I can just edit it in those locations.
So, I launch Bridge which typically looks for my external drive "FiveOGuys Photography Drive". I see Bridge open on my desktop, what is the next step to run the script? I believe the script has to be run via an application (built into OSX)?
I get that I should try this on a test sample of folders, so I'll just copy a few folders over to my desktop from "FiveOGuys Photography Drive" and use those. How do I direct the script to the test folders (I imagine I would put those three into a single folder lets say called "TEST") and then to the entire drive after testing?
Thanks
As it stands the above will run-in bridge as target… To run it would be best just to use the ExtendScript Toolkit… This can be found…
HD/Applications/Utilities/Adobe Utilities - CS5/ExtendScript Toolkit.app
Just cut and paste from here into a new window and run… ( on a test folder first )
It should ask you to select a top level folder/directory…
It currently uses today's date but I also left other options behind comments… the // lines…
Any problems give us a shot back should be close to what you asked…
If you like it save it using the Toolkit… It's possible to add this to Bridge UI if wanted…
North America
Europe, Middle East and Africa
Asia Pacific