On Jan 30, 2010, at 12:19 PM, Chuck Pelto wrote:
> Sooooo.....
>
> ....since Jon's Commands no longer work under Snow Leopard....
>
> ....how does one rename a file? I've tried numerous variations on what WAS a simple activity but nothing seems to work.
>
>
> Here's the latest of an hours worth of beating my head against the monitor....only to leave slobber all over it....
>
> set fileNameNew to (fileNameNew & mySuffix) as string -- new name for file
>
> set filePath to (srcFolder & fileName) as string -- path to file to be renamed
>
> set file name of file filePath to fileNameNew
>
set afile to choose file
tell application "Finder"
set name of afile to "This is my new name"
end tell
-or-
set afile to choose file
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set afolder to (text items 1 through -2 of ("" & afile)) as text
set AppleScript's text item delimiters to tid
do shell script "mv " & quoted form of POSIX path of afile & " " & quoted form of (POSIX path of afolder & "/" & "This is my new name")