go ahead... be a heretic | |
PerlMonks |
Re^2: Unable to write to log-fileby sselva (Novice) |
on Jul 29, 2009 at 16:06 UTC ( [id://784283]=note: print w/replies, xml ) | Need Help?? |
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)
In Section
Seekers of Perl Wisdom
|
|