&File::Find::find sub {
if ( -f $_ ) {
&do_something("${File::Find::dir}/$_") or
warn qq{Could not do_something() to "${File::Find::dir}/$_: $!"\n};
# does &do_something to the file in passing the absolute path. File::Find will change your cwd to do the find, so you could alternatively depend on paths relative to that cwd, which is also expressed as "$File::Find::dir".
# The viability of using $! for error reporting depends heavily on the contents of &do_something (i.e. whether this is a call that sets $! to report back system errors).
};
}, $dir;
Although the recommendation to use find2perl seems obscurantist, you should still see perldoc File::Find for more info on conditionals and package variables for File::Find.
Subrahmanyam Vadlamani wrote:
Hi:
I would like to recurse through a directory and do something with the files in the directory (and all sub-directories).
What is the most efficient way of doing this? What are some modules that I could use?
If someone has some example code, I would very much appreciate it.
thanks
Satish
__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs