First I have video files that record from webcam camera. It will got many file of videos but I want to delete duplicate file base on modification time, limited by minutes.
For example, I have 3 video files as below. base on (hour : minute : second)
- Ek001.AVI - time modification of file is 08:30:15
- Ek002.AVI - time modification of file is 08:30:40
- Ek003.AVI - time modification of file is 08:32:55
I want to get remains output.
- Ek001.AVI - time modification of file is 08:30:15 (first file created remaining)
- Ek003.AVI
Now I have code for find modification time as below.
import os
import datetime
import glob
from datetime import datetime
for file in glob.glob('C:\\Users\\xxx\\*.AVI'):
time_mod = os.path.getmtime(file)
print (datetime.fromtimestamp(time_mod).strftime('%Y-%m-%d %H:%M:%S'),'-->',file)
Please supporting me to adapt my code for delete duplicate file based on modified time, limited by minutes.