Arie Reynaldi Z wrote:
Guys,
This list is the best ! I got so many input to do my job, I haven't try it all, but surely I'll do it in a while. Another thing, I just got another python script from a friend to do the backup - erase, and i'd like to share it. :)
import glob import os dir = '/home3/division/' files = glob.glob('%s/*' % dir) files.sort() for file in files[:-7]:
Is this a little dangerous? It looks like it will delete the last seven files in the dir - every time you run it! Surely you want to put a date restriction on it so it won't delete newer files than you should? Or maybe delete the oldest files but KEEP at least x of them. I didn't read any earlier posts on this so maybe I'm barking up the wrong tree :) Mike
command = 'rm %s' % file print command os.system( command )
regards, and thanks to you all.. :)