]> git.phdru.name Git - xsetbg.git/blob - find_oldest.py
Rename db_file to xsetbg_db_path
[xsetbg.git] / find_oldest.py
1 #! /usr/bin/env python
2 """Count shown files; display the date of oldest file
3
4 This file is a part of XSetBg.
5
6 """
7
8 __author__ = "Oleg Broytman <phd@phdru.name>"
9 __copyright__ = "Copyright (C) 2006-2014 PhiloSoft Design"
10 __license__ = "GNU GPL"
11
12 from time import localtime, asctime
13 from xsetbg_db import xsetbg_db
14
15 count = 0
16 oldest = None
17
18 for key in xsetbg_db.keys():
19    count += 1
20    if key.startswith('/') and ((oldest is None) or (xsetbg_db[key] < oldest)):
21       oldest = xsetbg_db[key]
22 xsetbg_db.close()
23
24 print count, "files"
25 print "Oldest:", asctime(localtime(oldest))