Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2007
    Location
    Manchester
    Posts
    2,236
    Tokens
    118
    Habbo
    hamheyelliot

    Latest Awards:

    Default Cron to delete contents of folder?

    I finished the redux of my old project IconToucan today, but I came across the one little pain that's going to stack up.

    When a .zip is generated by the site, it gets stored in /zips indefinitely and requires someone to venture into the folder each time and clear it out.

    I've never been any good at cron jobs at all, and stuff I've searched for just flies over my head. Does anyone know how I can have the contents of the folder deleted on a daily basis?

    All replies appreciated with rep I also anticipate it's a tricky job so if you find anything around Google etc. feel free to point it out!

  2. #2
    Join Date
    Jun 2008
    Location
    United Kingdom
    Posts
    2,015
    Tokens
    568

    Latest Awards:

    Default

    Command to use is
    :
    : /bin/rm -r -f /path/to/directory/*
    :
    : The format of a crontab file is:
    :
    : mm hh DD MM WW Command
    :
    : where
    :
    : mm = Minute to run the command
    : hh = Hour
    : DD = Day of the month
    : MM = Month
    : WW = Day of the week
    :
    : So use:
    :
    : 12 4,19 * * * /bin/rm -r -f /path/to/directory/*
    :
    : "12 4,19" = at 04:12 and 19:12 (outside peak business hours!)
    : "* * *" = every day of every month, every day of the week
    : "/bin/rm" = run "rm" (ReMove), which is installed in "/bin/"
    : "-r" = "recursive mode"
    : "-f" = "force mode" (doesn't prompt)
    : "/path/to/directory/" = self-explanatory
    : "*" = everything inside it, but not the directory itself
    Seems pretty helpful.

    Found here: http://www.1-script.com/forums/Help-...e111344--2.htm

  3. #3
    Join Date
    Nov 2007
    Posts
    1,253
    Tokens
    150

    Latest Awards:

    Default

    Why not do a PHP jobby, whenever a new ZIP is generated quickly delete ZIPs that have a 'modified' date of more than a day?


    www.fragme.co = a project.

  4. #4
    Join Date
    Dec 2007
    Location
    Manchester
    Posts
    2,236
    Tokens
    118
    Habbo
    hamheyelliot

    Latest Awards:

    Default

    Quote Originally Posted by Source View Post
    Why not do a PHP jobby, whenever a new ZIP is generated quickly delete ZIPs that have a 'modified' date of more than a day?
    Sounds typically more useful, only problem is it seems a little excessive if this extra script is ran every single time (at the moment usage is quite frequent). I also wouldn't have any idea where to start

    I think a scheduled job rather than a dynamic one would suit what I need, so I'll give the cron above a go! Thanks for your help here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •