• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Search Folder Hierarchy
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Search Folder Hierarchy


  • Subject: Re: Search Folder Hierarchy
  • From: has <email@hidden>
  • Date: Sat, 28 Jan 2006 18:55:35 +0000

Simon, Garry wrote:

>I need a script that will:
>
>* Process a disk or folder dropped onto it
>* Search through every level of subfolders for files
>* Make a list of the names of the files it finds (excluding the folder
>names from the list)
>* Convert that list to a return deliminated text document (that part I
>could probably figure out).

Save as applet:

   on open {f}
      tell application "Finder" to set lst to name of every file in entire contents of container f
      set text item delimiters to return
      tell application "TextEdit" to make new document with properties {text:lst as Unicode text}
   end open

This approach'll suck performance-wise if there's a very large number of files, however. If this is an issue, consider using the unix shell instead, e.g. something like:

   ls -R /path/to/sourcefolder | egrep '^[^/]+$' | sort -f > /path/to/outputfile.txt

would produce a UTF8-encoded text file containing a nicely sorted [1] list of linefeed-delimited filenames.

has

[1] With the usual caveats regarding old-timey shell tools and their ignorance of non-ASCII characters.
--
http://freespace.virgin.net/hamish.sanderson/
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Search Folder Hierarchy
      • From: Martin Orpen <email@hidden>
  • Prev by Date: Re: FTP Upload
  • Next by Date: Re: FTP Upload
  • Previous by thread: Re: Search Folder Hierarchy
  • Next by thread: Re: Search Folder Hierarchy
  • Index(es):
    • Date
    • Thread