#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2006
    Posts
    390
    Rep Power
    15

    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.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    San Francisco Bay
    Posts
    1,939
    Rep Power
    1313
    It depends on the system, but rm *.pk4 would work on a Unix shell.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2006
    Posts
    390
    Rep Power
    15
    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.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2006
    Posts
    390
    Rep Power
    15
    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.
  8. #5
  9. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,592
    Rep Power
    4207
    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
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2006
    Posts
    390
    Rep Power
    15
    Yeah they are. Ill give it a try, thanks.
  12. #7
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Location
    Dublin, Ireland
    Posts
    174
    Rep Power
    44
    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.
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2006
    Posts
    390
    Rep Power
    15
    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.

IMN logo majestic logo threadwatch logo seochat tools logo