Re: Best way to auto rename files
Re: Best way to auto rename files
- Subject: Re: Best way to auto rename files
- From: Kai <email@hidden>
- Date: Wed, 19 Feb 2003 00:51:21 +0000
on Tue, 18 Feb 2003 20:26:32 +0100, Christian Vinaa <email@hidden>
wrote:
>
I have a folder with files that I need to give a new name; or more
>
accurately; I need to expend the file names with the same number;
>
i.e. file "Jones" will be renamed "567 Jones" and file "Smith" into
>
"567 Smith"
>
>
whats the best way to do this ?
>
>
set newPart to "567"
>
set name of file "Jones" to newpart & " Jones"
>
set name of file "Smith" to newpart & " Smith"
>
>
will rename the first file
>
>
but not the following ones
I'm surprised that even the first filename gets changed, Christian - since
there appears to be no path information to indicate exactly where your files
are on your disk. Does your script include some code that isn't shown above?
To rename all files in a folder, something like this should work:
=========================
set f to choose folder
set p to "567 "
tell application "Finder"
repeat with i in f's files
set n to i's name
set i's name to p & n
end repeat
end tell
=========================
--
Kai
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.