Page 1 of 1

Auto Delete Old Stuff (Tivo Style)

Posted: April 1st, 2009, 4:32 pm
by jayc
I'm trying to create a script that would delete anything older than x number of days.

I've written a script that does what I'm looking for in PHP.  My main problem now is that the file dates are not when the file was downloaded.  They are instead, when the file was originally created/uploaded to usenet.

I've found that the php touch command would allow me to set the date to my date of download.

My problem now is that I don't know how to access the file name(s) of the files downloaded while I'm in my php script.  Any ideas or do I have to learn a new language?

J

Re: Auto Delete Old Stuff (Tivo Style)

Posted: April 1st, 2009, 6:05 pm
by jayc
I think I have it figured out.  I'll just do a touch on dir/*, then make my script to a cleanup of any files older than x days if it starts to get low on space.

Re: Auto Delete Old Stuff (Tivo Style)

Posted: April 3rd, 2009, 3:11 pm
by huleboeren
Remember to share your work afterwards :P

Re: Auto Delete Old Stuff (Tivo Style)

Posted: April 4th, 2009, 10:44 am
by jayc
Sure, no problem.

Basically, my folder ever has less than 2GB free, it will delete the oldest 2GB of files in that folder.

http://pastie.org/436870

If anyone has a hankering to convert this, I'd love if it were native to SABNZBD.  Unfortunately, I'm not a python guy.