[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FINDFILE and Unix

In article <UgYl4.136$lr1.1749@llnews>,
	dsreyn@ll.mit.edu (Doug Reynolds) writes:
> I recently had some problems with the FINDFILE function.  First
> of all, the Online Help documentation contains an error:
>    Under UNIX, to refer to all of the files in a directory
>    only, use FINDFILE('/File_Specification/*.*'). To include
>    all the files in any subdirectories, use
>    FINDFILE('/File_Specification/*')
> However, under Unix, a call with "*.*" omits any files that do
> not include "." in their name.  In addition, searching for
> "*.*" does not prevent searching through subdirectories - if a
> directory name contains ".", FINDFILE will include any files
> within it.
> Now, the reason I was looking through the documentation in the
> first place is that FINDFILE can not do what I was trying to
> do.  We have a directory that contains 97 subdirectories
> starting with "f" - "f300", "f301", "f302", etc.  I wanted to
> get a list of all of these subdirectories.  Here is what
> happened:
>       IDL> files = findfile ("/users/username/f*") IDL> help,
>         files FILES               STRING    = Array[1767]
> The problem is that in addition to returning the directory
> names I wanted, FILES also included all the files and
> subdirectories in these directories. Unfortunately, under Unix,
> there is no way to make FINDFILE return a directory name
> without also including the contents.

You probably shouldn't use the 'ls' command as the workhorse
of your new FINDFILE command, but rather the Unix 'find' command,
which will work for large numbers of files.  I have a version
called FINDFILES on my web page that you might find useful:


but I can't recall if you can restrict it to find just 
directories.  If not, it would be easy to add a keyword to
do so (and send me the update :-)


-bob mallozzi

Robert S. Mallozzi                                       256-544-0887
                                                      Mail Code SD 50
http://gammaray.msfc.nasa.gov/           Marshall Space Flight Center 
http://cspar.uah.edu/~mallozzir/                 Huntsville, AL 35812