• 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: Applescript Help...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Applescript Help...
      • From: Bill Briggs <email@hidden>
References: 
 >Applescript Help... (From: Don Wieland <email@hidden>)

  • Prev by Date: Re: RAM and CPU hogging
  • Next by Date: Re: Finding Filenames that contain a certain string
  • Previous by thread: Re: Applescript Help...
  • Next by thread: Re: Applescript Help...
  • Index(es):
    • Date
    • Thread