Re: Applescript Help...
Re: Applescript Help...
- Subject: Re: Applescript Help...
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 19 Jul 2007 18:49:06 -0400
On 7/19/07, Bill Briggs <email@hidden> wrote:
tell application "Finder"
-- activate
set fileSource to alias "MacHD:Path:to:the:folder:"
set itemList to every item of fileSource as alias list
set parentName to name of fileSource
set n to count of itemList
repeat with i from 1 to n
set tempName to name of item i of itemList
set newName to parentName & "_" & tempName
set name of item i of itemList to newName
end repeat
end tell
That doesn't look quite right. parentName needs to loop through the
immediate subfolders of fileSource.
This works OMM:
tell application "Finder"
set fileSource to alias "HD:Path:to:Source"
set fileDest to alias "HD:Path:to:Target"
set subFolders to (every folder of fileSource) as alias list
repeat with parent in subFolders
set parentName to name of parent
set itemList to every item of parent as alias list
repeat with thisFile in itemList
set fileName to name of thisFile
set name of thisFile to parentName & "_" & fileName
move thisFile to fileDest
end repeat
end repeat
end tell
--
Mark J. Reed <email@hidden>
_______________________________________________
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