|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
creating/deleting files based on time
Can anyone tell me if there's a way to do the following?
I need to create a program which will run automatically every week or something, and delete all files created before that date, and create new files after the newest on in the directory. The files are based on dates and in the format of yy/mm/dd (i.e. one file would be called 20010619 and be todays date). I need the program to create a new file based on this date format. Any response appreciated. Cheers. Flink |
|
#2
|
|||
|
|||
|
dependant on the operating system
Hi,
It entirely depends on the operating system. If it is for Linux, you have to keep the file in the cronjob which is set to run daily, weekly or monthly. For windows, you have to use scheduler for the script to run periodically. ![]() |
|
#3
|
||||
|
||||
|
To determine the age of the file, try using the -M switch:
Code:
if (-M $file > 1)
{
# do stuff here if file is greater then 1 day old.
}
Mickalo
__________________
Thunder Rain Internet Publishing Custom Programming & Database development Providing Personal/Business Internet Solutions that work! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > creating/deleting files based on time |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|