newbie help - parsing pathnames to rename files
newbie help - parsing pathnames to rename files
- Subject: newbie help - parsing pathnames to rename files
- From: Draper Kauffman <email@hidden>
- Date: Thu, 28 Feb 2008 15:07:22 -0600
We have a very large database of graphic files, stored as follows:
~/resources/<account>/<project#>/<artist>/<nn?.extension>
I've been asked to find a way to rename all of the graphic files to
add the account code (6 characters), the project number (1 to 4
digits), and optionally the artist's name in front of the existing 2
or 3-character filename and 3-character extension.
Acceptable formats for the new filenames would be any of these:
<artist>_<account>_<project#>_<existing file name>
<account>_<project#>_<artist>_<existing file name>
<account>_<project#>_<existing file name>
The first format is preferred, but if <artist> is included there will
have to be a way to truncate it if it would make the new name too
long. The second format is acceptable and might make the truncation
process easier. However, the third format avoids the whole problem
and is also acceptable.
If anyone knows of a commercial product or existing AppleScript
program that can do what I need, I'd deeply appreciate a pointer.
Failing that, my fallback plan is to try to learn enough AppleScript
to hack this out.
I was a programmer back in the age of dinosaurs (pre-Lisa/Mac), but
so far, I'm finding this pretty heavy going. There's a nice function
for renaming files in the sample "Add to File Names.scpt". The
problem I'm having is finding a way to parse the pathname and convert
the last three folder names to text strings.
If you have or know of resources or examples of this kind that I can
borrow/learn from, I'd be very grateful for the help.
Drake
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden