If you are not averse to rolling your own then this may do the trick:
#!/usr/bin/perl -w use strict; my $root = 'c:/cluster1/'; # must have trailing path delim! my $delim = '/'; my @dirs = ($root); my @files; for my $path (@dirs){ opendir ( DIR, $path ) or next; # skip dirs we can't read while (my $file = readdir DIR) { # skip the dot files next if $file eq '.' or $file eq '..'; # skip symbolic links next if -l $path.$file; if ( -d $path.$file ) { # add the dir to our dir list push @dirs, $path.$file.$delim; } else { # add the file to file list push @files, $path.$file; } } closedir DIR; } print "Directory list\n\n"; print "$_\n" for sort @dirs; print "\n\nFile List\n\n"; print "$_\n" for sort @files;
This works by adding found directories to the end of the @dirs list we are iterating over. BTW I don't quite understand how you get to a directory that does not exist but you can change the default behaviour of this code when it can't opendir a DIR to whatever you want. Just change the next.....
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: catching errors from file::find
by tachyon
in thread catching errors from file::find
by VicBalta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |