Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Traversing directories recursively

by andreas1234567 (Vicar)
on Nov 20, 2007 at 10:06 UTC ( #651890=note: print w/replies, xml ) Need Help??


in reply to Traversing directories recursively

Works for me:
$ mkdir foo bar $ touch bar/1 $ touch bar/2 $ touch bar/3 $ touch foo/4 $ touch foo/5 $ touch foo/6 $ mkdir -p bar/tze $ touch bar/tze/7 $ touch bar/tze/8 $ touch bar/tze/9 $ perl -w 651889.pl | sort | uniq -c 1 ./651889.pl 1 ./bar 1 ./bar/1 1 ./bar/2 1 ./bar/3 1 ./bar/tze 1 ./bar/tze/7 1 ./bar/tze/8 1 ./bar/tze/9 1 ./foo 1 ./foo/4 1 ./foo/5 1 ./foo/6
I'd rather use File::Find:
$ perl -wle 'use strict; use File::Find; find(sub { print if -f }, "." +);' 651889.pl 1 3 2 8 7 9 6 5 4
--
Andreas

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://651890]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2019-07-20 07:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?