Re: Script that "Tells" Finder just Focuses on Finder instead of running
Re: Script that "Tells" Finder just Focuses on Finder instead of running
- Subject: Re: Script that "Tells" Finder just Focuses on Finder instead of running
- From: Deivy Petrescu <email@hidden>
- Date: Sat, 03 Jan 2015 11:52:35 -0500
> On Jan 3, 2015, at 11:02 , Alex Hall <email@hidden> wrote:
>
> Thanks for that. I don't fully understand it, but it does seem to work. The problem is that it doesn't print file names, only folder names and subdirectories. I need that *plus* what files are in each directory. I'll see if I can modify the example command you sent to do that. Even if I wrap it in AS to make it easier to execute, this seems much easier than a full script to do the same thing, and probably much faster. The guy I'm making this for sent me a sale from a Windows program he used for this same purpose, and the thing has hundreds of filenames in it. I didn't realize it, but speed is apparently going to be a factor.
>> On Jan 3, 2015, at 10:46 AM, 2551 <email@hidden> wrote:
>>
>>
>>> On 3 Jan 2015, at 21:47, Deivy Petrescu <email@hidden> wrote:
>>
>>> Actually, there is a command to do exactly that.
>>> It had been broken for a very long time, and everyone complained about that.
>>> After it was fixed it has been rarely mentioned.
>>>
>>> <script>
>>> tell application "Finder"
>>> set mainfldr to target of window 1
>>> return entire contents of mainfldr as alias list
>>> end tell
>>> <script>
>>>
>>> It is very fast too!
>>>
>>
>>
>> That just times out on my system if done on the home directory (didn't try it on anything smaller).
>>
>> For this kind of task, sed is your friend, combined with a bit of ls -R (Ahh, Yvan, beat me to it!) and grep:
>>
>> In Terminal, navigate to the directory you want to list with
>>
>> cd
>>
>> Then
>>
>>
>> ls -R | grep ":" | sed -e 's/://' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' | open -f
>>
>>
>> I think you'll find that's....pretty fast, even on your home directory.
>>
>> Phil
Alex,
Phil’s solution is by far the fastest and possibly the best solution.
However, it gives you the output in a “unixy” format.
“entire contents”, on the other hand, is not that bad!
I just tried it on a folder of 34799 files and it took about 5 seconds (MPB 2014).
The advantage is that it gives you the output in a “Findery” format, which might be easier to play around to find folder and number of files on them.
By the way, on the 34799 files, there are files 12 levels deep.
Deivy Petrescu
email@hidden
_______________________________________________
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