• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to rename a file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to rename a file?


  • Subject: Re: How to rename a file?
  • From: Graff <email@hidden>
  • Date: Sat, 06 Dec 2003 17:06:35 -0500

First of all, I'm assuming that you have that code within a tell block to the Finder, since "duplicate" and "displayed name" are Finder commands and properties.

Secondly, displayed name is a read-only property so it can't be set.

I tried this code and it works fine, but doesn't set the extension:
-----------
tell application "Finder"
duplicate theFile
set theNewFile to the result
set the name of theNewFile to bundleName
end tell
-----------

To have the extension remain the same you need to do something similar to this code:
-----------
tell application "Finder"
duplicate theFile
set theNewFile to the result
set theExtension to the name extension of theFile
set the name of theNewFile to bundleName & "." & theExtension
end tell
-----------

- Ken

On Dec 6, 2003, at 4:36 PM, Mark Dawson wrote:

How do you rename a file (in my case from a duplication)?
Here's is my code (10.2.8):

duplicate theFile
set theNewFile to the result
set the displayed name of theNewFile to bundleName

I tried both "displayed name" and "name"; I also put in a default name
("temp"); in all cases I get an error, "Can't set file name "x copy" of
folder "xx"  to "temp"

Thanks,

Mark
email@hidden
_______________________________________________
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.
_______________________________________________
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.

References: 
 >How to rename a file? (From: Mark Dawson <email@hidden>)

  • Prev by Date: Re: Reading resource forks
  • Next by Date: Reading a file as it fills up by another program
  • Previous by thread: How to rename a file?
  • Next by thread: Bring FileMaker window to front
  • Index(es):
    • Date
    • Thread