Though it executes as intended, there is a warning message as "Name
"main::FH" used only once: possible typo at fren.pl line 5.", what does that
mean?

Thanks,
_S_

-----Original Message-----
From: Mark Goland [mailto:mgoland@;optonline.net]
Sent: Thursday, October 24, 2002 12:08 PM
To: [EMAIL PROTECTED]
Subject: Re: How to rename file with a serial extension for backup?


You can probebly make it work with open, I am nto sure how to. This will
work...
#!/usr/local/bin/perl -w
use Fcntl; # for perm constants
use Errno; # for errno constants

unless ( sysopen ($FH,"test.txt",O_WRONLY|O_CREAT|O_EXCL, 0744) ){

 if( $!{EEXIST} ){
  print "file exists \n ";
  # rename it here
 }
 }



----- Original Message -----
From: "chris" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 23, 2002 9:32 PM
Subject: How to rename file with a serial extension for backup?


> Before I re-invent the wheel...
>
> I open a file for output but do not want to overwrite if it exists. It
> should be renamed with a serial number as an extension
>
> for example
> filename test.txt
>
> rename to
> test.001
> test.002
> test.003
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to