import initial
darcs-hash:20060121010713-4ec08-6343d69fa2207ec7bf79732fd1231841d38be512.gz
This commit is contained in:
parent
b850eeb932
commit
f7226c9415
1 changed files with 26 additions and 0 deletions
26
gestion/nettoie_cimetiere.py
Normal file
26
gestion/nettoie_cimetiere.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
#:! /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)
|
Loading…
Add table
Add a link
Reference in a new issue