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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |