I was able to writeout the files on a filesystem to a file C:/filelist.txt
using the program -

$path = "$ARGV[0]";
opendir ( DIR, $path ) or die "Can't open $path: $!";
while(defined($DIR = readdir DIR))
    {
     push(@array_A,$DIR)
     }
closedir DIR;
open(FILE,">c:/filelist.txt");
foreach $y (@array_A)
{
print "$y\n";
print FILE "$y\n";
}
close FILE;

Can you please tell me how to modify the above program to ignore the "." and
"..", so that they donot get printed in C:/filelist.txt ?

Can you also let me know how to read the line in the below file, look for
the second and forth " and write the name of the file fetched in the
above program before the second and fourth " and between the fifth and sixth
" one by one.

"SL/" "%HOME%/server/bin/" "" NA
as in
"SL/one" "%HOME%/server/bin/one" "one" NA


Thanks again.



On 7/7/06, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote:

Nishi Bhonsle wrote:
> Hi:
>
> Can you please help me write a perl script that takes the files from a
> directory and spits out the filenames into a file.
> say.
> I have a file structure on a file system such as
> C:\Temp\one
> C:\Temp\two
> C:\Temp\one\oneone
> C:\Temp\one\onetwo
> C:\Temp\one\onethree
>
> The original file contains lines in the foll format --
> "SL/" "%HOME%/server/bin/" "" NA
>
> This original file will be updated by the perl script to contain the
> filenames in the foll manner --
> "SL/one" "%HOME%/server/bin/one" "one" NA
> "SL/oneone" "%HOME%/server/bin/oneone" "oneone" NA
> "SL/onetwo" "%HOME%/server/bin/onetwo" "onetwo" NA
> etc
>
> Please help.
>
> Thanks a lot!
>

See `perldoc File::Find` and `perldoc File::Basename`


--
__END__

Just my 0.00000002 million dollars worth,
  --- Shawn

"For the things we have to learn before we can do them, we learn by
doing them."
Aristotle

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Reply via email to