Renaming folders

Can anyone tell me how to rename a folder within an AppleScript? I’m kinda new at this…

I’m currently trying to create an automated, multiple-application installer script, and part of it requires folders to be moved and then renamed in order to work with our pagination system.

For some reason, nothing I’ve tried has worked. Wouldn’t it have been a good idea for Apple to use “rename” as the language command to carry out this operation? Script Editor thinks “rename” is a variable. Neither the syntax “set ‘[foldername]’ to ‘[newfoldername]’” nor “set folder ‘[foldername]’ to folder ‘[newfoldername]’” works. I’ve searched the Finder dictionary and still can’t come up with anything.

Anyone have an idea?

Use “set name of…” in a finder tell block.

set theItem to (choose folder)
set theNewName to "myFolder"

tell application "Finder"
	set name of theItem to theNewName --> This line does all the work :-)
end tell

“Name” along with most of the properties of files, folders, etc. is a both a read AND write property, so there’s not a specific command for ‘renaming’ them. Just tell the finder to set it’s new value, making sure to pass it appropriate values and it’ll take care of the rest.