TStanley has asked for the wisdom of the Perl Monks concerning the following question:
There are several files and directories under the directory that I'm searching and there has to be an easier way than by going through each directory by hand.#!/opt/perl5/bin/perl -w use strict; use File::Find; ## I'm writing the file listings in this directory my $WriteDirectory="/home/mis/tstanley/Migrate"; ## This is the directory I want to traverse through my $TraverseDirectory="/dsmpayroll"; finddepth(&perms, $TraverseDirectory); sub perms{ my $pwd=`pwd`; # Get the directory I'm in my $file=$pwd; $file=~s/\//\./g; # Change the "/" into "." my $perms=`ls -l`; my $acl=`lsacl *`; open FH, ">$WriteDirectory/$file"||die"Can't open $file: $!\n"; print FH "$pwd"; print FH "$perms"; print FH "$acl"; close FH; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Traversing through a directory structure
by kvale (Monsignor) on Mar 02, 2005 at 20:20 UTC | |
|
Re: Traversing through a directory structure
by dmorelli (Scribe) on Mar 02, 2005 at 20:39 UTC | |
by Fletch (Bishop) on Mar 03, 2005 at 01:52 UTC | |
|
Re: Traversing through a directory structure
by RazorbladeBidet (Friar) on Mar 02, 2005 at 20:30 UTC | |
|
Re: Traversing through a directory structure
by crashtest (Curate) on Mar 02, 2005 at 23:10 UTC | |
|
Recursive functions
by jhourcle (Prior) on Mar 03, 2005 at 00:24 UTC |