my @files=<path/to/list_of_files> ; ##should be good enough

-----Original Message-----
From: Ing. Branislav Gerzo [mailto:[EMAIL PROTECTED]
Sent: Friday, February 04, 2005 1:57 PM
To: beginners@perl.org
Subject: Re: Deleting selected files in a directory through perl


Kamalraj  Singh  Madhan, Noida [KSM], on Friday, February 4, 2005 at
13:38 (+0530 ) typed:

KSM>     Kindly let me know if this possible, deleting some selected files
from a
KSM> directory through a perl script. This selection would be based on the
KSM> filename existing in a particular text file, if it exists then delete
from
KSM> directory otherwise not since I do not want to delete all of the files
in
KSM> this directory.

my @files = ( 'D:\test\test.txt', 'D:\test\test2.txt' );
#if you want read read that txt with file list:
#my @files = `cat filelist.txt`; #or use type, if you haven't cat
unlink $_ or warn "Can't delete $_ $!\n" for (@files);

somtehing like this ? (untested:)

--

 ...m8s, cu l8r, Brano.

[I live in a quiet neighborhood - they use silencers.]



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



*********************************************************
Disclaimer:

The contents of this E-mail (including the contents of the enclosure(s) or 
attachment(s) if any) are privileged and confidential material of MBT and 
should not be disclosed to, used by or copied in any manner by anyone other 
than the intended addressee(s).   In case you are not the desired addressee, 
you should delete this message and/or re-direct it to the sender.  The views 
expressed in this E-mail message (including the enclosure(s) or attachment(s) 
if any) are those of the individual sender, except where the sender expressly, 
and with authority, states them to be the views of MBT.

This e-mail message including attachment/(s), if any, is believed to be free of 
any virus.  However, it is the responsibility of the recipient to ensure that 
it is virus free and MBT is not responsible for any loss or damage arising in 
any way from its use

*********************************************************

-- 
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