ajout de la doc pydoc
darcs-hash:20061123200724-f46e9-fdd14a07b448b323145a69bae0d9c66a3eb54f71.gz
This commit is contained in:
parent
e8132317e8
commit
d37a454b53
5 changed files with 165 additions and 32 deletions
41
lib/utils/files.py
Normal file → Executable file
41
lib/utils/files.py
Normal file → Executable file
|
@ -1,13 +1,44 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
# #############################################################
|
||||
# ..
|
||||
# .... ............ ........
|
||||
# . ....... . .... ..
|
||||
# . ... .. .. .. .. ..... . ..
|
||||
# .. .. ....@@@. .. . ........ .
|
||||
# .. . .. ..@.@@..@@. .@@@@@@@ @@@@@@. ....
|
||||
# .@@@@. .@@@@. .@@@@..@@.@@..@@@..@@@..@@@@.... ....
|
||||
# @@@@... .@@@.. @@ @@ .@..@@..@@...@@@. .@@@@@. ..
|
||||
# .@@@.. . @@@. @@.@@..@@.@@..@@@ @@ .@@@@@@.. .....
|
||||
# ...@@@.... @@@ .@@.......... ........ ..... ..
|
||||
# . ..@@@@.. . .@@@@. .. ....... . .............
|
||||
# . .. .... .. .. . ... ....
|
||||
# . . .... ............. .. ...
|
||||
# .. .. ... ........ ... ...
|
||||
# ................................
|
||||
#
|
||||
# #############################################################
|
||||
"""
|
||||
files.py
|
||||
|
||||
Fonction de base sur les fichiers
|
||||
|
||||
Copyright (c) 2006 by www.crans.org
|
||||
"""
|
||||
|
||||
import datetime, time, os
|
||||
|
||||
def ageOfFile(pathToFile):
|
||||
pathToFile = os.path.expanduser(pathToFile)
|
||||
return int(time.time()) - os.path.getmtime(pathToFile)
|
||||
"""renvoie l'age d'un fichier en secondes"""
|
||||
pathToFile = os.path.expanduser(pathToFile)
|
||||
return int(time.time()) - os.path.getmtime(pathToFile)
|
||||
|
||||
def fileIsOlderThan(pathToFile, days=0, hours=0, minutes=0, seconds=0):
|
||||
time= (((days*24) + hours) * 60 + minutes) * 60 + seconds
|
||||
return ageOfFile(pathToFile) > time
|
||||
"""teste si un fichier est plus vieux on non que la valeur donnée"""
|
||||
time= (((days*24) + hours) * 60 + minutes) * 60 + seconds
|
||||
return ageOfFile(pathToFile) > time
|
||||
|
||||
def dirIsEmpty(pathToDir):
|
||||
return os.listdir(pathToDir) == []
|
||||
"""teste : répond True si le dossier est vide."""
|
||||
return os.listdir(pathToDir) == []
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue