rename file in OSX

Hello,
I am trying to rename a file. In OS9, something like this would work to rename a file “data disk:aaaa” to “data disk:bbbb”


tell application "Finder"
	set oldfname to "aaaa"
	set newfname to "bbbb"
	set fulloldname to "data disk:"&oldfname
	set fullnewname to "data disk:"& newfname
	set name of file fulloldname to fullnewname
end tell

When I try this in OSX, I get the error, “Can’t set name…”. If I just say to select the old file, that does work.
Any ideas what’s going on here?

Ken

I don’t think the name of a file is permitted to contain a colon. The script above is trying to change the name to “data disk:bbbb”.

Oh, I see. It now only works if you specify the path using something like

set name of file “aaaa” of disk “data disk” to “bbbb”

Thanks.

Ken

No, it’s not that. You can refer to files using the path, but the “name” of the file cannot contain a colon. Maybe this is what you need:

tell application "Finder"
	set oldfname to "aaaa"
	set newfname to "bbbb"
	set fulloldname to "data disk:" & oldfname
	--set fullnewname to "data disk:" & newfname
	set name of file fulloldname to newname
end tell

Thanks Rob,
That is what I was after.

Ken