• 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: Rename Folder without it moving
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rename Folder without it moving


  • Subject: Re: Rename Folder without it moving
  • From: Jeff Hanlon <email@hidden>
  • Date: Thu, 30 May 2013 01:30:05 +0000
  • Thread-topic: Rename Folder without it moving

Thanks Luther!

It works great.
I made a few changes to make it work with my existing shell script.  I'm sending this over Apple Remote Desktop so the AS is contained in the osascript block.
My original shell command for renaming the folder is commented out for reference.


myDate=`eval date +%m%d%y`

# mv "/Users/ladmin/Desktop/IMAGED ON - " "/Users/ladmin/Desktop/IMAGED ON - $myDate"


osascript <<EndOfMyScript

set itemLoc to POSIX file "/Users/ladmin/Desktop" as alias

set itemName to "IMAGED ON - "

set newName to itemName & "$myDate"


tell application "Finder"

activate

try

set itemAlias to (item itemName of itemLoc) as alias

on error

beep

return -- itemAlias does not exist

end try

-- change other attributes of itemAlias here

set name of the result to newName -- do this last

end tell

EndOfMyScript



Jeff


From: Luther Fuller <email@hidden>
Date: Wednesday, May 29, 2013 11:48 AM
To: "email@hidden Users" <email@hidden>
Subject: Re: Rename Folder without it moving

On May 29, 2013, at 1:32 PM, Jeff Hanlon wrote:

Is there a way to retain the position by using an applescript or some
additional bash command?

I tried this simple AppleScript …

set itemLoc to path to desktop
set itemName to "untitled folder"
set newName to "New Folder Name"

tell application "Finder"
activate
try
setitemAlias to (itemitemName of itemLoc) as alias
on error
beep
return-- itemAlias does not exist
end try
-- change other attributes of itemAlias here
set name of the result tonewName -- do this last
end tell


It worked with no problem. My experience is that changing the name should be done last if you are changing attributes other than the name.



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Re: Rename Folder without it moving (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Word 2008 script broken in Word 2011
  • Next by Date: Re: Word 2008 script broken in Word 2011
  • Previous by thread: Re: Rename Folder without it moving
  • Next by thread: Re: Excel print area
  • Index(es):
    • Date
    • Thread