Cron Job: Deleting Files & Folders

NiceCarpet

New Member
Messages
9
Reaction score
0
Points
0
Hello : )

I currently have symlink anti-leech script running and need a cron command or php script to be ran by a cron job to remove files/folders in this dir: "/home/webacc/public_html/files/*" apart from index.php and .htaccess

I have been trying a few commands I have found on Google but nothing to aid me yet >< eather they choke on system() commands or just don't work with out any error.

So could someone please assist me in the code needed that will run on these servers correctly (I have PHP Intermediate version if thats any help).

Thank You very much : D
Edit:
For anyone else that is having this problem here is what I ended up doing:

I put a .htaccess that contaned:

Code:
IndexIgnore *
DirectoryIndex ../index.php
So since my cron job uses this command set "rm -rf /home/MYUSERNAME/public_html/files/*"
with the time setting of:

Code:
*/5 * * * *
(Every 5 minutes)

It would remove both files and folders but not .htaccess (since rm doesn't deal with anything that has a dot in front of it)
 
Last edited:
Top