• 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: A little help with a folder cleanup script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A little help with a folder cleanup script


  • Subject: Re: A little help with a folder cleanup script
  • From: dev_sleidy <email@hidden>
  • Date: Wed, 9 Aug 2006 04:38:52 -0400

A few years ago ...

on open these_items
 repeat with this_item in these_items
 ...
 end repeat
end open

... which can be rewritten as:

on open these_items

 tell application "Finder"
  activate

repeat with this_item in these_items
open this_item
if (not (exists (folder "Documents" of this_item))) then move (items of window 1 whose name is not ("Documents")) to folder "Documents" of this_item with replacing
close this_item


  end repeat
 end tell

end open

This year I want to ... to leave a list of folders alone and move everything else into the documents folder.


Here are two (2) solutions:

on open (these_items)
 tell application "Finder"
  activate

repeat with this_item in these_items
open this_item
if (not (exists (folder "Documents" of this_item))) then make new folder at this_item with properties {name:"Documents"}
move (items of window 1 whose name is not in {"Desktop", "Documents", "Downloads", "Library", "Movies", "Music", "Pictures", "profile", "Public", "Roaming Media", "Sites"}) to folder "Documents" of this_item with replacing
close this_item
end repeat
end tell


end open

... or (since there is no real need to open a folder, just to handle items within it) ...

on open (these_items)
 tell application "Finder"
  activate

repeat with this_item in these_items
if (not (exists (folder "Documents" of this_item))) then make new folder at this_item with properties {name:"Documents"}
move (items of this_item whose name is not in {"Desktop", "Documents", "Downloads", "Library", "Movies", "Music", "Pictures", "profile", "Public", "Roaming Media", "Sites"}) to folder "Documents" of this_item with replacing
end repeat
end tell


end open


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >A little help with a folder cleanup script (From: Rick Davis <email@hidden>)

  • Prev by Date: Re: Select text (numeric words) between brackets
  • Next by Date: Re: A little help with a folder cleanup script
  • Previous by thread: A little help with a folder cleanup script
  • Next by thread: Re: A little help with a folder cleanup script
  • Index(es):
    • Date
    • Thread