January 28th, 2007, 07:14 PM
Need to delete all files with .pk4 using cron job!
What is the code to delete all files that have a ext of .pk4? I am having this small hosting place for pk4 files and I want it to delete them after a certan time they have been on there.
January 29th, 2007, 12:31 AM
It depends on the system, but rm *.pk4 would work on a Unix shell.
January 29th, 2007, 05:28 PM
I think I did that command befor but I'll give it another try to see if I did a spelling error or something. Will get back to you on it.
January 29th, 2007, 07:34 PM
No it did not work. I am using Cpanel to make this and it does not seem to work I have it run the command every min on the hour and every day and month.
January 29th, 2007, 11:14 PM
Are the pk4 files in subdirectories or what? If so, you could do something like this:
/usr/bin/find /path_to_base_dir -name "*.pk4" | /usr/bin/xargs /bin/rm -f
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
January 30th, 2007, 10:53 AM
Yeah they are. Ill give it a try, thanks.
January 30th, 2007, 12:32 PM
Note that, If you only want to delete files which are older than a given amount of time you should use something like the mtime switch.
/usr/bin/find /path_to_base_dir -mtime +7 -name "*.pk4" | /usr/bin/xargs /bin/rm -f
The above code would only delete pk4 files which are more than 7 days old.
January 30th, 2007, 04:38 PM
I get the first URL area but on the second URL area I don't get is there supposed to be a difference or both codes are supposed to be the same. I just want to clarify things.
EDIT Also cpanel's cron job keeps hiding the other half of the code. Is this a problem or not?
Last edited by ajm113; January 30th, 2007 at 04:49 PM.