Re: Delete file if it contains x y or z

2008-09-07 Thread Peter Scott
On Sat, 06 Sep 2008 16:01:08 +0100, brian54321uk wrote: > Just tried this, nothing happened at all. Really. $ echo abc > /tmp/bar/one $ echo xyz > /tmp/bar/two $ echo ab..yz > /tmp/bar/three $ ls /tmp/bar one three two $ cat /tmp/foo #!/usr/bin/perl use strict; use warnings; sub delete_contain

Re: Delete file if it contains x y or z

2008-09-06 Thread asmith9983
Here's another way, but not necessarily the best Perl, but it does work: #!/usr/bin/env perl use strict; use warnings; my @filelist=; chomp @filelist; my $match_strings=qr '(abc123blue|xyz357green)'; my ($file, ); foreach $file (@filelist) { #print "file=$file\n"; open(FD,"<$file") or die "Cann

Re: Delete file if it contains x y or z

2008-09-06 Thread brian54321uk
[EMAIL PROTECTED] wrote: Here's another way, but not necessarily the best Perl, but it does work: #!/usr/bin/env perl use strict; use warnings; my @filelist=; chomp @filelist; my $match_strings=qr '(abc123blue|xyz357green)'; my ($file, ); foreach $file (@filelist) { #print "file=$file\n"; Is

Re: Delete file if it contains x y or z

2008-09-06 Thread brian54321uk
Peter Scott wrote: On Fri, 05 Sep 2008 19:09:25 +0100, brian54321uk wrote: I would like to test a folder full of files, and if a file contains abc123blue or xyz357green then that file is to be deleted. What would be the best way of achieving this please? One way: use strict; use warnings; s

Re: Delete file if it contains x y or z

2008-09-06 Thread Peter Scott
On Fri, 05 Sep 2008 19:09:25 +0100, brian54321uk wrote: > I would like to test a folder full of files, and if a file contains > abc123blue or xyz357green then that file is to be deleted. > What would be the best way of achieving this please? One way: use strict; use warnings; sub delete_contain

Re: Delete file if it contains x y or z

2008-09-06 Thread brian54321uk
Aruna Goke wrote: brian54321uk wrote: Aruna Goke wrote: Mr. Shawn H. Corey wrote: On Fri, 2008-09-05 at 19:09 +0100, brian54321uk wrote: HI again I would like to test a folder full of files, and if a file contains abc123blue or xyz357green then that file is to be deleted. What would be the

Re: Delete file if it contains x y or z

2008-09-06 Thread brian54321uk
John W. Krahn wrote: Dr.Ruud wrote: brian54321uk schreef: I would like to test a folder full of files, and if a file contains abc123blue or xyz357green then that file is to be deleted. What would be the best way of achieving this please? I would use `grep -l` to get the list of filenames, an

Re: Delete file if it contains x y or z

2008-09-06 Thread brian54321uk
John W. Krahn wrote: Aruna Goke wrote: brian54321uk wrote: Aruna Goke wrote: Mr. Shawn H. Corey wrote: On Fri, 2008-09-05 at 19:09 +0100, brian54321uk wrote: HI again I would like to test a folder full of files, and if a file contains abc123blue or xyz357green then that file is to be delete

Re: Delete file if it contains x y or z

2008-09-06 Thread John W. Krahn
Aruna Goke wrote: brian54321uk wrote: Aruna Goke wrote: Mr. Shawn H. Corey wrote: On Fri, 2008-09-05 at 19:09 +0100, brian54321uk wrote: HI again I would like to test a folder full of files, and if a file contains abc123blue or xyz357green then that file is to be deleted. What would be the

Re: Delete file if it contains x y or z

2008-09-06 Thread John W. Krahn
Dr.Ruud wrote: brian54321uk schreef: I would like to test a folder full of files, and if a file contains abc123blue or xyz357green then that file is to be deleted. What would be the best way of achieving this please? I would use `grep -l` to get the list of filenames, and rm to unlink them. N

Re: Delete file if it contains x y or z

2008-09-06 Thread Dr.Ruud
brian54321uk schreef: > I would like to test a folder full of files, and if a file contains > abc123blue or xyz357green then that file is to be deleted. > What would be the best way of achieving this please? I would use `grep -l` to get the list of filenames, and rm to unlink them. No Perl involv

Re: Delete file if it contains x y or z

2008-09-06 Thread Aruna Goke
brian54321uk wrote: Aruna Goke wrote: Mr. Shawn H. Corey wrote: On Fri, 2008-09-05 at 19:09 +0100, brian54321uk wrote: HI again I would like to test a folder full of files, and if a file contains abc123blue or xyz357green then that file is to be deleted. What would be the best way of achievi

Re: Delete file if it contains x y or z

2008-09-05 Thread Aruna Goke
Mr. Shawn H. Corey wrote: On Fri, 2008-09-05 at 19:09 +0100, brian54321uk wrote: HI again I would like to test a folder full of files, and if a file contains abc123blue or xyz357green then that file is to be deleted. What would be the best way of achieving this please? If however, it would be

Re: Delete file if it contains x y or z

2008-09-05 Thread Jeff Pang
2008/9/6 Raja Vadlamudi <[EMAIL PROTECTED]>: > > for (glob("folder/*")) { > unlink if m/abc123blue|xyz357green/; > } > This would also delete "abc123blue.exe", "abc123blue.txt", "otherabc123blue" etc. OP could consider to use File::Find to do that. -- Regards, Jeff. -- To unsubscribe, e-mai

Re: Delete file if it contains x y or z

2008-09-05 Thread Mr. Shawn H. Corey
On Fri, 2008-09-05 at 19:09 +0100, brian54321uk wrote: > HI again > I would like to test a folder full of files, and if a file contains > abc123blue or xyz357green then that file is to be deleted. > What would be the best way of achieving this please? > > If however, it would be simpler for the s

Re: Delete file if it contains x y or z

2008-09-05 Thread Raja Vadlamudi
On Fri, Sep 5, 2008 at 2:09 PM, brian54321uk <[EMAIL PROTECTED]>wrote: > HI again > I would like to test a folder full of files, and if a file contains > abc123blue or xyz357green then that file is to be deleted. > What would be the best way of achieving this please? > > If however, it would be si

RE: delete file after on week

2005-10-24 Thread Steve Bertrand
> I need to delete files older than one week old, > I know how to code that(with the help of many kind people on > this list): Here is a single command that will blow files older than 48 hours away from given directory. You can put as many of these in a single sh script as you want

RE: delete file after on week

2005-10-24 Thread José Pedro Silva Pinto
Hi, ZHAO, If your system is Unix or similar, you can use cron (See cron). If Windows, you can use task manager José Pinto -Original Message- From: ZHAO, BING [mailto:[EMAIL PROTECTED] Sent: domingo, 23 de Outubro de 2005 7:28 Cc: beginners@perl.org Subject: delete file after on week

Re: delete file after on week

2005-10-23 Thread Jessica Rasku
ZHAO, BING wrote: Hi: I need to delete files older than one week old, I know how to code that(with the help of many kind people on this list): But it only happens when I run the program, there is a chance I will not be running the program for more than a week. And the d

Re: delete file

2003-07-11 Thread Asif Iqbal
try unlink . example: unlink $file; On Fri, 11 Jul 2003, Boon Chong Ang wrote: > Hi, > > My name is Boon Chong. I have question. Just say, I run a perl script > and in between of the process I create a temporarily file for checking > purpose. Now, how do I ask perl to delete the file automatically

Re: delete file

2003-07-11 Thread John W. Krahn
Boon Chong Ang wrote: > > Hi, Hello, > My name is Boon Chong. I have question. Just say, I run a perl script > and in between of the process I create a temporarily file for checking > purpose. Now, how do I ask perl to delete the file automatically? Use IO::File::new_tmpfile() perldoc IO::Fil

Re: delete file

2003-07-11 Thread Sudarshan Raghavan
Boon Chong Ang wrote: Hi, My name is Boon Chong. I have question. Just say, I run a perl script and in between of the process I create a temporarily file for checking purpose. Now, how do I ask perl to delete the file automatically? Automatically as in, when the script finished executing? Use t

RE: delete file

2003-07-11 Thread NYIMI Jose (BMB)
perl -f unlink http://www.perldoc.com/perl5.8.0/pod/func/unlink.html José. > -Original Message- > From: Boon Chong Ang [mailto:[EMAIL PROTECTED] > Sent: Friday, July 11, 2003 10:13 AM > To: [EMAIL PROTECTED] > Subject: delete file > > > Hi, > > My name is Boon Chong. I have question.

RE: delete file

2003-01-08 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Something like this: while ( 1 ) { printf "Please enter file to delete:"; chomp(my $filetodelete = ); last if ( $filetodelete =~ /^exit$/i ); printf "Deleting file: %-s\n", $filetodelete; while ( 1 ) { printf "Do you want to delete?: "; chomp(

RE: delete file

2003-01-08 Thread Dan Muey
Command line or html ? Unix or windows? -Original Message- From: Jakob Kofoed [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 2:38 PM To: [EMAIL PROTECTED] Subject: delete file Hi, How can I delete a file in a script - but get the script to ask me if I really want to del