Re: Script to change file name
Re: Script to change file name
- Subject: Re: Script to change file name
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 13 May 2003 07:33:51 -0700
On 5/13/03 7:02 AM, "Mark Peyer" <email@hidden> wrote:
>
Every day, I import a file named xyz from a Barcodereader, this is then
>
imported into FMP. Next day, the file xyz is replaced by a new xyz, and so
>
on.
>
For safety reasons I'd like to duplicate xyz, position it into another
>
folder and rename it with eg xyz.date.
>
I can manage the duplication and the repositioning, but I don't seem to be
>
able to change the file name. The box says: access not allowed.
>
>
I am the sole user on the system, so I do not suppose it has to do with
>
rights.
But you haven't shown us what you were attempting!
Perhaps you were trying to change the entire file path of an alias or Finder
file? Why don't you show us? Correct - that's not allowed. But you can set
just the _name_ of the file to something else in the Finder. Then, if you
still need to do other things with the file, you have to refer to it
subsequently by its new name or file path (or by a variable previously set
to it as an alias). For example:
tell application "Finder"
set theFolder to container of theFile
set name of theFile to "Changed Name"
set theFile to file "Changed Name" of theFolder
move theFile to anotherFolder
update theFile
end tell
--or
tell application "Finder"
set theFile to theFile as alias
set name of theFile to "Changed Name"
move theFile to anotherFolder
update theFile
end tell
'alias' is an AppleScript term (not the same as the 'alias files' we use in
the Finder) which keeps track of files even when you change their name and
location.
--
Paul Berkowitz
_______________________________________________
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.