Re: Shell script to get a list of all subfolders inside a folder
Re: Shell script to get a list of all subfolders inside a folder
- Subject: Re: Shell script to get a list of all subfolders inside a folder
- From: Shane Stanley <email@hidden>
- Date: Wed, 14 Oct 2015 10:34:03 +1100
On 14 Oct 2015, at 6:55 AM, Axel Luttgens <email@hidden> wrote:
>
>> First, it’s fraught with peril.
>
> Assuming I’m knowing what I’m supposed to put into some directory of interest, what kind of peril could I be overlooking?
I'm thinking more of me than you. It relies on my having to remember to watch out for any new package types, and update the script if I come across one.
> Throughout this thread, I performed my tests on a folder containing about 810000 files and 80000 directories.
>
> Running your first version of getFoldersIn (the one without BridgePlus) on it, slightly amended so as to return a list of posix paths instead of a list of file references, it returns 62335 items in 170-190 seconds.
>
> To get exactly the same result set, I have to run:
>
> set AppleScript's text item delimiters to {return}
> set mylist to text items of (do shell script "/usr/bin/find -E " & myfolder & " -type d \\( \\( -iregex '.*\\.(xcodeproj|deps|nib|app|pbproj|fs|ppp|workflow|xcode|xcdatamodel|pkg|bundle|lpdf|kext|dSYM|wdgt|settings|trace|Patch|split)$' -and -prune \\) -or -print \\)")
>
> That requires 30-40 seconds (with the loop for building a list of HFS paths, add 15 seconds).
I'm not sure what to say. I ran your latest version on my home folder, and it took about 80 seconds, versus 14-15.
Maybe some others will give them both a try, and report back.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
_______________________________________________
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