in reply to find2perl with File::Find and -maxdepth
In any case, i've yet to really solve this problem, but i've worked around it using a call directly to the underlying OS's find function. i had to open it at a filehandle to get the output back, so system didn't seem workable.
i don't like this because it's quite non-portable (important to me since i'm developing on linux, but this will run on an old solaris box), but.... well, it works.
Here's the find_test.pl code i came up with:
#!/usr/bin/perl -w # This is a poor way to list filenames using all the available # switches for your local 'find' command. It could probably be # better accomplished with File::Find, but i was not able to # make that work. use strict; use Data::Dumper 'Dumper'; # here you can use whatever arguments you like.... open FIND, "find . -name *.html -maxdepth 3 -mindepth 3 |"; # a large number, MAXLINE if you're being conscientous read FIND, my $find_output, 99999; # the find output is returned as one big string, so split it my @files = split(/\n/, $find_output); # dump the raw find output. note that it's all one value, # with \n (newline) in it. print Dumper [$find_output]; # now dump the array.. each 'hit' on it's own position print Dumper [@files]; exit 0;
If anyone has a better way to do this, i'm highly interested!
|
|---|