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'
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.