Get info for items in a folder
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