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

A little help with a folder cleanup script


  • Subject: A little help with a folder cleanup script
  • From: Rick Davis <email@hidden>
  • Date: Tue, 8 Aug 2006 23:04:10 -0400

A few years ago I used the following script to prepare home directories for a move from an ASIP/At Ease server to an OS X/ Macintosh Manager/WorkGroup Manager server. I used Stewart Macdonald's FileBlaster to delete items I knew I didn't want to keep and then this script to move the rest:

on open these_items

	repeat with this_item in these_items
		tell application "Finder"
			activate
			tell application "Finder" to open this_item

			if exists (folder "Documents" of this_item) then

				select (items of window 1 whose name is not ("Documents"))
				move selection to folder "Documents" of this_item with replacing
				close this_item
			else
				make new folder at this_item with properties {name:"Documents"}
				select (items of window 1 whose name is not ("Documents"))
				move selection to folder "Documents" of this_item with replacing
				close this_item
			end if
		end tell
	end repeat
end open


This year I want to clean up last years network home directories to prepare for a new year. But I want to leave a list of folders alone and move everything else into the documents folder.


This is the list of allowed folders:

Desktop
Documents
Downloads
Library
Movies
Music
Pictures
profile
Public
Roaming Media
Sites

Last years users were allowed to create folders and save files outside of their usual locations (made syncing a nightmare). I want the script to move any folders that are not in the above list into the Documents folder. I can get the above applescript to move everything into the Documents folder, but choking on getting the "not equal to" list into the script. I think a shell script might be easier, but my shell script skills are even more limited. Any scripting gurus willing to help?

Any and all suggestions greatly appreciated.

Rick Davis
_______________________________________________
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


  • Follow-Ups:
    • Re: A little help with a folder cleanup script
      • From: "J. Stewart" <email@hidden>
    • Re: A little help with a folder cleanup script
      • From: dev_sleidy <email@hidden>
  • Prev by Date: Re: bug in joining list items
  • Next by Date: rsync and backup
  • Previous by thread: RE: bug in joining list items
  • Next by thread: Re: A little help with a folder cleanup script
  • Index(es):
    • Date
    • Thread