How To print the files older than some x days | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How To print the files older than some x days

Using Python Language Only

27th Jan 2017, 7:17 AM
Gopikrishna A
Gopikrishna A - avatar
2 Answers
+ 1
Try to use os module and os.stat - you need to find ctime of file - this is a time when file have been created (but only for Unix-like os), then get time for now in unixtime: from time import time, and then: if (time() - ctime)/86400 > x then you need print this filename.
29th Jan 2017, 10:31 AM
Игорь Тирский
Игорь Тирский - avatar
0
thank u..
29th Jan 2017, 10:55 AM
Gopikrishna A
Gopikrishna A - avatar