🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.perl.misc
Article #332

Re: Perl script question for gurus

#332
From: Helmut Llamas Stuhne
Date: Mon, 01 Sep 1997 00:00
24 lines
1558 bytes
> A quick-n-dirty sketch, you may have to do a little debugging:
>
> #!/usr/bin/perl
>
> $dir = shift || ".";    # first argument is directory
> $start = shift || "0";  # second argument is starting number
>
> $fnbase = sprintf "%08d", $start;
> opendir(D, $dir) || die "can't open $dir? $!\n";
>
> @files = map { $_ if (-f $_ and $_ !~ /^0.*txt/)} readdir(D);
> closedir(D);
>
> foreach $file (@files) {
>         rename($file, $fnbase.".txt");
>         $fnbase++;
> }

Only open(D,$dir) you schould change in opendir(D,$dir).Now your script
is runnig, I have test it.

regards
    H.Stuhne
Technical Details
Message-ID: <340A846C.D6A042C8@microtec.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <Pine.SOL.3.96.970825153417.22465A-100000@purple.tmn.com> <yd8u3g8lq0c.fsf@hoshi.engr.sgi.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10f591,bbbaaa795486a906
X-Google-Attributes: gid10f591,public
X-Google-Thread: 112333,bbbaaa795486a906
X-Google-Attributes: gid112333,public
X-Google-Thread: 1133f4,bbbaaa795486a906
X-Google-Attributes: gid1133f4,public
X-Google-Thread: f72c1,bbbaaa795486a906
X-Google-Attributes: gidf72c1,public
X-Google-Thread: fa0ae,bbbaaa795486a906
X-Google-Attributes: gidfa0ae,public
From: Helmut Llamas Stuhne <llamashe@microtec.de>
Subject: Re: Perl script question for gurus
Date: 1997/09/01
Message-ID: <340A846C.D6A042C8@microtec.de>
X-Deja-AN: 269342900
References: <Pine.SOL.3.96.970825153417.22465A-100000@purple.tmn.com> <yd8u3g8lq0c.fsf@hoshi.engr.sgi.com>
To: Scott Henry <scotth@sgi.com>
X-Priority: 3 (Normal)
Organization: microtec electronic GmbH
Newsgroups: comp.lang.perl.misc,comp.lang.perl.modules,comp.lang.perl.tk,de.comp.lang.perl,fr.comp.lang.perl