fnicholas has asked for the wisdom of the Perl Monks concerning the following question:
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; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: remove files from the V volume on windows server 2008
by Crackers2 (Parson) on Aug 22, 2012 at 00:50 UTC | |
by fnicholas (Initiate) on Aug 22, 2012 at 13:19 UTC | |
Re: remove files from the V volume on windows
by BrowserUk (Patriarch) on Aug 22, 2012 at 00:34 UTC | |
by fnicholas (Initiate) on Aug 22, 2012 at 00:44 UTC | |
by BrowserUk (Patriarch) on Aug 22, 2012 at 00:58 UTC | |
by fnicholas (Initiate) on Aug 22, 2012 at 01:00 UTC | |
by aitap (Curate) on Aug 22, 2012 at 07:40 UTC |