Here we assume a Windows system. We'll check the c:\temp folder for files older than 90 days.
Older files will be moved to c:\archives, a folder already exists.
We'll setup the computer to do this task automatically every 7 days.
1. Using Notepad, save the Perl Example 6 --- archive old files
script as "archive.pl" in the folder "c:\autotasks". Make sure its file type is ".pl" instead of ".txt".
2. Using Notepad, edit a .bat file:
perl archive.pl c:\temp c:\archives 90
Save as "archive.bat" in the same directory "c:\autotasks". Make sure its file extension is ".bat" instead of ".txt".
3. Setup Scheduled task to run archiving task once every week.
|