26 lines
661 B
Python
26 lines
661 B
Python
#:! /usr/bin/env python
|
|
# -*- coding: iso8859-15 -*-
|
|
|
|
"""
|
|
Petit script pour nettoyer les fichiers vieux de plus d'un an dans le
|
|
cimetière.
|
|
Executé par cron tous les jours sur vert
|
|
"""
|
|
|
|
import os, time
|
|
|
|
datelimite = int(time.time()-365*24*60*60)
|
|
print datelimite
|
|
|
|
for dossier in ['/home/cimetiere/adherent',
|
|
'/home/cimetiere/club',
|
|
'/home/cimetiere/files',
|
|
'/home/cimetiere/machine']:
|
|
|
|
for fichier in os.listdir(dossier):
|
|
|
|
fichier = dossier+'/'+fichier
|
|
|
|
if os.path.getmtime(fichier)<datelimite:
|
|
print fichier
|
|
print os.remove(fichier)
|