Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
cronjob to delete a specific filename
Old 07-22-2006, 07:42 PM cronjob to delete a specific filename
Yak Yak Yak Yak Yak

Posts: 593
Location: Rochester, MN
Trades: 0
Is there a cronjob I could use to delete a specific file every hour?

So, it would find a file called filename.txt and delete it.
__________________

Please login or register to view this content. Registration is FREE
neorunner is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-23-2006, 01:38 PM Re: cronjob to delete a specific filename
ablaye's Avatar
Ultra Talker

Posts: 437
Location: WebmasterGround.com
Trades: 5
What you need to do is write a PHP script to delete the file.
Then set it as a cron job by going to your cpanel and creating a cron job to call your script every hour.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
ablaye is offline
Reply With Quote
View Public Profile Visit ablaye's homepage!
 
Old 07-23-2006, 01:48 PM Re: cronjob to delete a specific filename
Yak Yak Yak Yak Yak

Posts: 593
Location: Rochester, MN
Trades: 0
I found something like this:

find /yourdir/tmp -mtime +1 -exec rm {} \; //where 1 is number of days since it was modified

However, I wonder if there is a way to change the +1 from days to hours. So, instead of deleting a file older than 1 day, it would delete it if it is older than 1 hour.

Does anyone know how to do that?
__________________

Please login or register to view this content. Registration is FREE
neorunner is offline
Reply With Quote
View Public Profile
 
Old 07-29-2006, 04:20 AM Re: cronjob to delete a specific filename
Skilled Talker

Posts: 63
Trades: 0
going off of you code, to do it for hours...
find /yourdir/tmp -mmin +60 -exec rm {} \\anything of one hour

try man find in your console or google it, you'll find def for -mmin option.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
saidev is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to cronjob to delete a specific filename
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12976 seconds with 12 queries