File Path Query

Hi There,

If I have the filepath “Macintosh HD:Digital Camera Shots:x:y:z:file.jpg” is there a simple way of getting the x,y,z parts, out of the path, so I can add them to filename and end up with a file called “xyzfile.jpg”?

Thanks in advance,

Nick

This may work:

set f to "Macintosh HD:Digital Camera Shots:x:y:z:file.jpg"

set AppleScript's text item delimiters to ":"
set newName to f's text items -4 thru -2
set AppleScript's text item delimiters to {""}

tell application "Finder" to set name of alias f to ("" & newName & name of alias f)