Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 19th, 2001, 03:51 AM
Flink Flink is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2000
Location: Manchester, UK
Posts: 47 Flink User rank is Private First Class (20 - 50 Reputation Level)Flink User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 h 48 m 9 sec
Reputation Power: 8
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

Reply With Quote
  #2  
Old June 19th, 2001, 05:36 AM
suchitra suchitra is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 0 suchitra User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.



Reply With Quote
  #3  
Old June 19th, 2001, 05:41 AM
mickalo's Avatar
mickalo mickalo is offline
Ole` Timer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: N.W. Iowa
Posts: 469 mickalo User rank is Private First Class (20 - 50 Reputation Level)mickalo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 5 h 19 sec
Reputation Power: 8
Send a message via AIM to mickalo Send a message via MSN to mickalo
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!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > creating/deleting files based on time


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT