Hi Experts,

Here i am trying to create a script for Auto Back up script to Back up files. files are taking a back up with help of archive zip module along with mentioned the date in corresponding Folder name. Here i am create one xml file for daily updation. BAsed on the date script will be executed at once. which not equal to current date. else back up does not pick bcs same condition which is equal to true. XML file does not get append the daily date.

use strict; #use File::Copy; use Archive::Zip; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime; $year += 1900; $mon++; my $today = "$mon-$mday-$year"; print $hour-$min; my $filetobecopied = "test.pl"; my $newfile = "test1.pl";mkdir($today); mkdir($today); my $zip = Archive::Zip->new(); $zip->writeToFileNamed("$today/$newfile\.zip"); open (WRK, "logfile.xml") || die "Cannot open the input file"; read WRK, my $wrk_xml, -s WRK; close(WRK); my $getdate=$1 if ($wrk_xml=~ m{<date>(.*?)</date>}); print $getdate; my $date_flag; if($getdate == $today){ $date_flag = 'false';} else { $date_flag = 'true';} if($date_flag == 'true'){ print "test"; ### Prepare ready.xml process . . . my $ready=<<READY; <backup-file> <date>$today</date> <name>$newfile</name> </backup-file> READY print "test"; open (REA, ">>logfile\.xml") || die "Cannot Open thelog xml file"; print REA $ready; close (REA); } else { print "$hour- $min"; my $ready=<<READY; <backup-file> <date>$today $hour-$min</date> <name>$newfile</name> </backup-file> READY open (REA, ">>logfile\.xml") || die "Cannot Open thelog xml file"; print REA $ready; close (REA); }

Advance thanks, Senthil. V


In reply to to create a Back up script the files by senthil_v

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.