in reply to File deletion
Hi,
It is very easy in Perl.Use the below steps:
Thanks marto for pointing out the error , updated the code, now working correctly.
It is very easy in Perl.Use the below steps:
use strict; my $file_location = shift; open(FH,">","log.txt") or die "unable to open file log.txt"; my @files = <$file_location/*>; foreach my $file (@files){ system("rm $file"); unless( $? == -1 ){ print FH "\n$file is deleted.."; } else{ print FH "\n$file is not deleted.. $!"; } } close FH;
Thanks marto for pointing out the error , updated the code, now working correctly.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: File deletion
by marto (Cardinal) on May 06, 2013 at 12:16 UTC | |
Re^2: File deletion
by marto (Cardinal) on May 06, 2013 at 12:19 UTC | |
Re^2: File deletion
by thezip (Vicar) on May 06, 2013 at 18:29 UTC |
In Section
Seekers of Perl Wisdom