Re: List content of a folder, output to document
Re: List content of a folder, output to document
- Subject: Re: List content of a folder, output to document
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 6 Jan 2010 09:44:55 -0500
On Tue, Jan 5, 2010 at 6:18 PM, Shane Stanley
<email@hidden> wrote:
> I'd be nervous about using entire contents on any large file (OK, so I'm
> nervous about Finder scripting generally these days). You might try using a
> shell command like this:
>
> set theStuff to do shell script "find " & (quoted form of POSIX path of
> (choose folder)) & " \\! -name '[.]*' -print"
That works, but you don't need either the backslash(es) or the
brackets. A single exclamation point as a word by itself doesn't
trigger history substitution, and the name pattern to find uses shell
glob syntax, not regular expression syntax, so '.' just means period
(the "match any character" symbol is the question mark).
Also, that prompts the user to choose a folder; the stated goal was to
use a context-menu-triggered script. Maybe this works?
tell application "Finder" to set theFolder to the
selection as alias
However you get the start folder, if all you want to do with the list
is write it to a text file, you might as well let the shell do that
part, too.
do shell script "find " & (quoted form of POSIX
path of theFolder) & " ! -name '.*' -print >" & (quoted form of POSIX
path of theTextFile)
--
Mark J. Reed <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