Hi All,

I have a questions to all the perl monks out there. I wrote a little script to create a folder based on local time and move all *.log files in that shared directory (my $filedir")into the newly created folder. When I run the script, it just creates the folder on my local workstation (where the script is located - D:\Perl\Bin), and not on the intended remote location. It also looks like it "deleted" all the logs files located in the remote directory rather than moving it into the new folder. Please help....I've been trying to figure this out for hours but with no avail...

thanks,

(The script creates the folder correctly based on local time stamped, but only on my workstation rather the remote share (\\10.1.1.5\weblogiclogs), also the "move" section in the script looks like it's moving all logs in the remote share somewhare else rather the the intended folder that was created by the script - the time stamped folder.)

********************* use POSIX; ********************************************** * Specify remote share the script will affect *********************************************** my $filedir = "\\\\10.1.1.5\\Weblogiclogs"; *************************************************** * Specify any logs in the weblogiclogs directory **************************************************** my $IWlogs = "\\\\10.1.1.5\\Weblogiclogs\\*.log*"; # Get Local Time and Create folder based on local time stamped my $createdir = strftime( '%y%d%e%H%M%S', localtime); # Create folder based on local time obtained above if(!-e $createDir) { mkdir $createdir or die "Couln't create $createdir because $! +($^E)\n"; } # move logs files to new created directory named after # the local time. @args = ( "move" , $IWlogs , $createDir ) ; system( @args ) == 0 or die "error moving $IWlogs reason $!($^E)"; #

In reply to Creating Folder based on local time and moving logs into it by Anonymous Monk

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.