Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Unable to write to log-file

by sselva (Novice)
on Jul 29, 2009 at 16:06 UTC ( [id://784283]=note: print w/replies, xml ) Need Help??


in reply to Re: Unable to write to log-file
in thread Unable to write to log-file

Hi , As you said you need the list of directories in to a log file, for this you can use the flie commands. here is the code which is working fine for me , as it will read all directories inside in the given path .
( path have to be given in command line for exampel perl <file name> <folder name> .
use File::Path;
use File::Find;
use vars /@files $file $path/;
$path = $ARGV[0];
find sub{ push @files, "$File::Find::name" if(-d
$File::Find::name); },$path;
print @files;
open FILE,">>direcotry.txt" or die $!;
print FILE @files;

(-d $File::Find::name) : this will give you the directories inside the path which you gave at command line . ( you can use -f to find the files)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-25 10:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found