177 users online (0 members and 177 guests)  


  Results 1 to 2 of 2

Related

  1. Can't open (FILE,"$filename")    Forum: CGI Perl Forum
    Replies: 2
  2. help submit dynamic filename in form    Forum: HTML Forum
    Replies: 1
  3. Replies: 3
  1. #1
    tannx's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2007
    Location
    Tallinn
    Posts
    1

    add timestamp into filename

    script below edits the file and writes new output file also removing file extension. I need to add timestamp into filename. I have script what gives me the date and time but I don't know how to integrate it into script.
    Code:
     $failid=&quot;&quot;; $fail=0; if (open(FAILIDcnt, $failid)) {            while($line = ) {                $pnt[$fail]=($line); print &quot;$line\n&quot;;                  $fail ++;            }          close (FAILIDcnt); } $failm=0; do {        too( $pnt[$failm]);        $failm ++; } until $failm>$fail; sub too {    my @sisse = @_;    my $fff=$sisse[0];    if (open(IF, $fff)) {             $fff=~ s/\.txt// < $aasta;        open(OF,&quot;>&quot;.$fff) or die &quot;Can't open $fff!&quot;;        while($line = ) {               if ($line =~ /^(-------------------)/) {            close (OF);            close (IF);            return 0;}          $line =~ s/\t/;/g;          print OF &quot;$line&quot;;        }   } }
    timestamp
    Code:
     ($sec,$min,$hour,$mday,$mon,$year,$wday, $yday,$isdst)=localtime(time); printf &quot;%4d-%02d-%02d_%02d:%02d:%02d\n&quot;, $year+1900,$mon+1,$mday,$hour,$min,$sec;

  2. #2
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: add timestamp into filename

    Such tiny boxes, I can#t read it properly particularly because of "" been removed.



Tags for this Thread