On Jan 2, 2015, at 5:40 PM, Shane Stanley wrote: Possibly not. The property you should probably use is class.
The Finder is notoriously slow, and I wouldn't use if for something like this unless you're only going to use it with small-ish folders. You mentioned shell alternatives, but they fall foul of package documents. Nevertheless, something like this should get you started:
There is a problem telling the difference between a document which is a package or bundled folder and a plain vanilla folder.
I was slow to remember this, but there is a way to do it.
This example script looks inside folders that it should not ...
property testFolder : alias "OS_X:Library:Frameworks"
on run my getFolders(testFolder) end run
on getFolders(folderAlias) tell application "Finder" set folderList to (folders of folderAlias) as alias list repeat with aFolder in folderList display dialog (name of aFolder) as text my getFolders(aFolder) end repeat end tell end getFolders
The test folder I have used in this example is full of folders with the extension 'framework'. The script above will show the contents of these folders, however, but you don't want to see the contents of these folders. The following script has a small modification which corrects this problem ...
property testFolder : alias "OS_X:Library:Frameworks"
on run my getFolders(testFolder) end run
on getFolders(folderAlias) tell application "Finder" set folderList to (folders of folderAlias) as alias list repeat with aFolder in folderList if (name extension of aFolder) = "" then display dialog (name of aFolder) as text my getFolders(aFolder) end if end repeat end tell end getFolders
If the test folder contains a folder named "untitled.folder" then the script WILL look inside because 'folder' is not a valid name extension. But 'framework' is a valid extension and the script will NOT look inside these folders. Package documents DO HAVE valid name extensions, so the script will not look into their contents.
|