Cron Job to delete files in a directory

software development

#1

Hi, I have tried everything to get this working.

I am hoping I can do this with a cron script.

I am trying to delete files in a directory every 30 minutes.

In the old CPANEL days, it was easy to set up the cron Job but I am having problems trying it in DreamHost.

Any help would be greatly appreciated![hr]
Here is the php file I used:

<?php $files = glob("/some/dir/*.flv"); foreach($file in $files) unlink($file); ?>

#2

Here are two shell scripts (bourne shell) that will accomplish the same task. Here’s a good bourne shell tutorial.

#!/bin/sh
cd /some/dir
/bin/rm *.flv
#!/bin/sh
/bin/rm /some/dir/*.flv