This Perl script moves files from one directory to another if they are older than a specified number of minutes based on their last modification time. The script takes three parameters: the source path, destination path, and age in minutes. It can handle moving files across midnight and leap years. The script is intended to automate regularly moving files, such as failed application logs, to free up space or prepare files for reprocessing.
This Perl script moves files from one directory to another if they are older than a specified number of minutes based on their last modification time. The script takes three parameters: the source path, destination path, and age in minutes. It can handle moving files across midnight and leap years. The script is intended to automate regularly moving files, such as failed application logs, to free up space or prepare files for reprocessing.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online from Scribd
This Perl script moves files from one directory to another if they are older than a specified number of minutes based on their last modification time. The script takes three parameters: the source path, destination path, and age in minutes. It can handle moving files across midnight and leap years. The script is intended to automate regularly moving files, such as failed application logs, to free up space or prepare files for reprocessing.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPTX, PDF, TXT or read online from Scribd
Eid-1878 23/02/2011 Functionality • This is written for Windows/unix • This script will move the files from one directory to another directory those are having specific minutes older with respec to last modification time. • To run this script we have to give 3 paramters. <path_from> , <path_to> , <age>. • As you can see these 3 parameters are self explanatory . • By this you can save much time. • This is designed in such a way that it can handle leap year, New year , New day roll over after midnight. Where Can we use • We can set up a sentry to move files on any kind of server where we can install perl. • Here with I am attaching the expected outputs Of this script by using which we can set up a sentry. Script_outut How it helps my team • Actually we have a application called Magllean which is on Windows Servers. We have set up many directories like /temp, /Success, /cdr. sometimes files those are got failed to process it goes to /temp directory. So we do a manual move of files( those are 30 having more than 30 minutes of last modification time )to /cdr for reprocess. Advantages • By doing this we save lot of time as this page came around many times in a day. • As in windows we cant write shell scripts to automate that’s why I wrote this script in perl script. • Please contact me if you find any difficulties in it. bmallik@qwest.com
Here is the attached script.
Attachment of script (Please open with notepad/notepad++)