Help - Search - Members - Calendar
Full Version: Script to Clean out Directory?
Hostony Board > General Support > PHP/MySQL
RAGEnCHAOS
hi guys i am looking for a PHP script that can be ran as a Cron job to delete the contents of a folder and possibly run 1 time every 12 hours if possible any one wanna write it for me ?
Alec
It is more simply to write bash or perl script performing this task.

Example of bash script (it is includes one command line only):

CODE
#!/bin/sh

rm -rf /path/foldername/*


You should place this script outside of your public_html, i.e. in your root folder /home/username

Also be careful with rm command. Linux does not support 'Recycle Bin' smile.gif

To run it every 12 hours you should configure Cron jobs in your control panel.

Here are your cron patterns:

* */12 * * * - run job every 12 hours starting from adding new iten
* 1,13 * * * - run job at 1:00 and 13:00 everyday
etc.
RAGEnCHAOS
cool cool thank you and i can use that to clean out any directory and specify it ?
Alexandre
Yes you can.
But you should to be more careful with files removing.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.
IPS Driver Error

IPS Driver Error

There appears to be an error with the database.
You can try to refresh the page by clicking here