• 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
Get info for items in a folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Get info for items in a folder


  • Subject: Get info for items in a folder
  • From: Joe <email@hidden>
  • Date: Sat, 20 Oct 2007 15:49:10 -0700


I am trying to write a script that will let me crawl through the contents of a folder
returning some information about each item contained therein. I have a rough
script structure (below) but I wanted to get a reality check before continuing.


One of the lines of the script uses "entire contents." I have read in the list
archives both that was broken and that it was fixed. My own tests with small
folder trees is that it works. Any feedback about "every folder in the entire
contents of x" (?)


The script requires the Satimage OSAX as well.

<SCRIPT>
set topFolder to (choose folder with prompt "Pick a folder:") as alias

tell application "System Events"
set topFileList to (every file of topFolder whose visible is true) -- list every file in the folder of choice
end tell


if topFileList is not {} then processfiles(topFileList)

tell application "Finder" --list every folder in entire contents of the folder of choice
try
set foldrs to (every folder in the entire contents of topFolder) as alias list --if it has multiple folders
processfolders(foldrs)
on error --has 1 or less folder
try
set foldrs to (every folder in the entire contents of topFolder) as alias as list --if it only has 1 folder
processfolders(foldrs)
on error --no folders here
--handle error and quit
end try
end try
end tell


on processfolders(folderlist)
	--repeat with whatever
	--get info for each folder
	--list files in each folder (uses Satimage "list files")
	try
		set filz to list files thisfolder without recursively
		processfiles(filz) --send list of files to next step
	end try
	processfiles(thisFoldersFiles)
	--end repeat
end processfolders

on processfiles(filelist)
	--repeat with thisstuff
	--get some info about each file
	--end repeat
end processfiles
<END>

Thanks for any feedback

Joe
_______________________________________________
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: Get info for items in a folder
      • From: Philip Aker <email@hidden>
    • Re: Get info for items in a folder
      • From: "Gary (Lists)" <email@hidden>
  • Prev by Date: Re: AppleScript 2.0?
  • Next by Date: Re: Get info for items in a folder
  • Previous by thread: iCal updates with new events
  • Next by thread: Re: Get info for items in a folder
  • Index(es):
    • Date
    • Thread