At 14.57 1998.02.23, Frederick Bruckman wrote: >How do you tell if a File System Spec is for a file, or a directory? >FSpGetCatInfo seems to assume that you know already, and the built-in >coercion leaves off the trailing colon. I'm working on a script that uses >FSpIterateDirectory to walk an arbitrary collection of folders and >subfolders, and sorts them neatly. What I have so far works very fast, but >I can't figure out how to make it leave the subdirectories alone. Use -d and -f (directory and file checks). Now, this is implemented via stat(), which is a bit slow. So the second call (-f _) is a special call that says "do the -f check on the result of the last call to stat()", which in this case is "-d $thing". Also, you don't need to have MakeFSSpec() here, but that is what you asked about, so I put it in. #!perl -wl foreach (@ARGV) { my $thing = MacPerl::MakeFSSpec($_); print "$_ -- ", -d $thing ? 'directory' : -f _ ? 'file' : '?'; } -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6']) #== New Book: MacPerl: Power and Ease ==# #== Publishing Date: Early 1998. http://www.ptf.com/macperl/ ==# ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch