[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Perl question
- Subject: [ale] Perl question
- From: terry at bitlinx.com (Terry Bailey)
- Date: Wed, 11 Apr 2007 20:37:38 -0400
Hi,
I want to use a Perl script to remove just the files that end in x,
so I wrote the following, but it deletes every file in the
directory. What am I not seeing? This afternoon, I got tired of
using nano and started using wordpad. Do you think there is an
embedded character that doesn't show?
$x = "x";
open(INPIPE, "ls /cygdrive/D/ftproot/abc -1pt | grep -v / |");
while ($hold = <INPIPE>){
chomp($hold);
$tmp = $hold;
$right = chop($hold);
if ($x eq $right){system("rm /cygdrive/d/ftproot/abc/$tmp");}
}
close(INPIPE);
Thanks,
Terry Bailey
-------------- next part --------------
An HTML attachment was scrubbed...