dunnsearch Posted August 29, 2008 Share Posted August 29, 2008 How can i use cron to auto delete all the contents of a folder every 24 hours? I use DirectAdmin for my server? Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/ Share on other sites More sharing options...
dunnsearch Posted August 29, 2008 Author Share Posted August 29, 2008 Please help? Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-628878 Share on other sites More sharing options...
DarkWater Posted August 29, 2008 Share Posted August 29, 2008 0 0 * * * rm -f /path/to/dir/directoryname/* Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-628884 Share on other sites More sharing options...
dunnsearch Posted August 29, 2008 Author Share Posted August 29, 2008 thank you soo much but where do i put that? lol Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-628900 Share on other sites More sharing options...
DarkWater Posted August 29, 2008 Share Posted August 29, 2008 thank you soo much but where do i put that? lol In your crontab file? Wait. Does your DirectAdmin thing have a cron interface to "simplify" things? Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-628910 Share on other sites More sharing options...
dunnsearch Posted August 29, 2008 Author Share Posted August 29, 2008 ya it simplifies things. what do i do? thank so much DarkWater Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-628916 Share on other sites More sharing options...
DarkWater Posted August 29, 2008 Share Posted August 29, 2008 Can I see a screenshot of the interface it gives you? Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-628917 Share on other sites More sharing options...
dunnsearch Posted August 29, 2008 Author Share Posted August 29, 2008 i dont have a screen taker, i can enter the minute, hour, day, week and month myself. i just need the command. its like the simplified version of cPanel? is that ok? Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-628921 Share on other sites More sharing options...
DarkWater Posted August 29, 2008 Share Posted August 29, 2008 rm -f /path/to/directory/* Yes, the * belongs there. Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-628926 Share on other sites More sharing options...
dunnsearch Posted August 29, 2008 Author Share Posted August 29, 2008 ok, thank you so much DarkWater, your a lifesaver have you got any script to show the local time from a pc and my server time? if you dont its ok. just making sure im not missing out Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-628933 Share on other sites More sharing options...
DarkWater Posted August 29, 2008 Share Posted August 29, 2008 Both at the same time? Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-628949 Share on other sites More sharing options...
dunnsearch Posted August 29, 2008 Author Share Posted August 29, 2008 two different scripts or the same script its up to you i you have Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-628956 Share on other sites More sharing options...
dunnsearch Posted August 29, 2008 Author Share Posted August 29, 2008 would that cron code work with a file is well? Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-628967 Share on other sites More sharing options...
DarkWater Posted August 29, 2008 Share Posted August 29, 2008 What do you mean? Also, with the displaying local time and server time...that's a mixture of PHP and Javascript. Why do you need to show both? I mean, it can certainly be done though. Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-628971 Share on other sites More sharing options...
dunnsearch Posted August 29, 2008 Author Share Posted August 29, 2008 if i direct that cron code to a file will it clear whats in the file or the file its self? i need the server and local time because users and servers times will be different and the users will know not to upload just before 7AM in the servers time as it will be clearing all files thanks to the cron code you gave me Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-628997 Share on other sites More sharing options...
DarkWater Posted August 29, 2008 Share Posted August 29, 2008 How about you just delete all files that have been on the server for more than 24 hours instead? Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-629000 Share on other sites More sharing options...
dunnsearch Posted August 30, 2008 Author Share Posted August 30, 2008 then the rapidleech will be deleted Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-629668 Share on other sites More sharing options...
DarkWater Posted August 30, 2008 Share Posted August 30, 2008 Uhh....what? I meant all the uploaded files that have been there for more than 24 hours instead of blindly clearing out files. Link to comment https://forums.phpfreaks.com/topic/121881-how-do-i-use-cron-to-auto-delete-a-folders-contents/#findComment-629790 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.