perlwannabe wrote:
>
> Not at all. I am checking various sources for this problem. The
> responses on the usenet were helpful...but the problem remains. I came to
> the mailing list to have a direct dialogue with individuals rather than a
> post that will get lost in two days. I am appreciativ
On Fri, 25 Jul 2003 15:18:39 -0600, [EMAIL PROTECTED] wrote:
> FYI: I have been doing perl for about two weeks, so if my answer screws you up,
> don't sue me please! :D
>
> You would do something like this:
>
> foreach my $string ()
> {
>
Perlwannabe wrote:
>
> Here is my problem. I want to delete the files contained in a directory
> from a list contained in a file. Here is an example:
>
> The input file is a regular text file in the following format (call it
> myfile.txt);
>
> item1
> item2
> item3
> item4
>
>
> What I w
FYI: I have been doing perl for about two weeks, so if my answer screws you up, don't
sue me please! :D
You would do something like this:
foreach my $string ()
{
system "cmd del *string*";
}
I believe that is right. But even if I am, some of these other guys will show you a
better way
C:\>perldoc -f unlink
unlink LIST
unlink Deletes a list of files. Returns the number of files
successfully deleted.
$cnt = unlink 'a', 'b', 'c';
unlink @goners;
unlink <*.bak>;
Note: "unlink" will not delete director
> -Original Message-
> From: Michael Pastore [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 15, 2002 8:48 AM
> To: [EMAIL PROTECTED]
> Subject: deleting files
>
>
> Hello All,
>
> Just a quick question on deleting files in Perl.
>
> I am trying to delete some files in a directory, but
M
To: [EMAIL PROTECTED]
Subject: Re: deleting files
Michael Pastore wrote:
>
> Hello All,
Hello,
> Just a quick question on deleting files in Perl.
>
> I am trying to delete some files in a directory, but I do not know their
> names...just ending extension...
>
> I ha
Michael Pastore wrote:
>
> Hello All,
Hello,
> Just a quick question on deleting files in Perl.
>
> I am trying to delete some files in a directory, but I do not know their
> names...just ending extension...
>
> I have tried:
>
> One way:
>
> unlink <*.dat>;
> unlink <*.p1>;
>
> Another wa
Got it working :)
Thanks to Mike, Nikola and Janek...
Have a wonderful day!!!
Mike
-Original Message-
From: Mike(mickalo)Blezien [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 15, 2002 9:04 AM
To: Michael Pastore
Cc: [EMAIL PROTECTED]
Subject: Re: deleting files
Hi Michael
no offense, but using that method you won't know if all the files were
really removed.
> -Original Message-
> From: Janek Schleicher [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 15, 2002 8:01 AM
> To: [EMAIL PROTECTED]
> Subject: Re: deleting files
>
>
>
Hi Michael,
One way is to read the directory that you want to delete the files. This works
very well for me:
my $DIR = '/path/to/folder';
my($deletefile,$removefile);
opendir (DIR, "$DIR") or die $!;
my @files = grep(/\.(dat|pl)/i,readdir(DIR));
closedir (DIR);
foreach $removefile (@files)
Michael Pastore wrote at Mon, 15 Jul 2002 14:48:12 +0200:
> I am trying to delete some files in a directory, but I do not know their
>names...just ending
> extension...
>
> I have tried:
> One way:
>
> unlink <*.dat>;
> unlink <*.p1>;
>
> Another way:
>
> unlink glob(".dat");
> unlink glob("
foreach $file (glob("/path/to/files/*.dat"), glob("/path/to/files/*.p1")){
unlink($file) || die "cannot unlink file $file: $!";
}
> -Original Message-
> From: Michael Pastore [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 15, 2002 8:48 AM
> To: [EMAIL PROTECTED]
> Subject
13 matches
Mail list logo