Hi Monks:

I am a newbie to Perl. I am currently a Systems Administrator in the Washington DC area.

Please I need your assistance. I need to complete the following for work function but i am still stuck on trying to complete the first part of the script below. I still can't get script to delete the files on the V volume on the Window Server.

Implement a script that checks for the available space on the V and X Volumes on a Window Server 2008 EE.

1. If the available space is less than 3.5 TB on the V Volume, the script deletes any SyscoDB database backup files older than 2 weeks.

2. If the available space is less than 3.5 TB on the V Volume, the scripts moves any SyscoDB database backup files older than 1 week to the X Volume.

#A script that check If the available space is less # than 3.5 TB on the V Volume, #and deletes any #SyscoDB database backup files older than 2 weeks. #!/usr/bin/perl use warnings; use strict; use Win32::DriveInfo; my $file; my $dir_to_process = "V:/Backups/SyscoDB"; my $V_TotalNumberOfFreeBytes = Win32::DriveInfo::DriveSpace('v:'); my $V_RoundedTotalNumberOfFreeGigabytes = sprintf("%.2f", ($V_TotalNumberOfFreeBytes/1073741824)); print "The Free Size is : $V_RoundedTotalNumberOfFreeGigabytes GB\n"; if ( $V_RoundedTotalNumberOfFreeGigabytes < 3.5 && $V_RoundedTotalNumberOfFreeGigabytes == 3.5) { opendir DH, $dir_to_process or die "Cannot open $dir_to_process: $!"; foreach $file (readdir DH){ unlink $file or warn "failed on $file: $!\n" if -M $file > 14; } closedir DH; }

In reply to remove files from the V volume on windows server 2008 by fnicholas

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.