-
Notifications
You must be signed in to change notification settings - Fork 3
/
DriveParser.py
27 lines (21 loc) · 905 Bytes
/
DriveParser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import time
def list_files(path):
# returns a list of names (with extension, without full path) of all files
# in folder path
files = []
for name in os.listdir(path):
if os.path.isfile(os.path.join(path, name)):
files.append(name)
return files
def parseDrive(filename, beginTimeFrame = 0, endTimeFrame = int(time.time())):
listOfDrive = []
# for file in list_files(locationName):
#st_mtime only works on linux systems http://stackoverflow.com/questions/237079/how-to-get-file-creation-modification-date-times-in-python
timestamp = int(os.stat(filename).st_mtime)
if int(timestamp) < endTimeFrame and int(timestamp) > beginTimeFrame:
fileInfo = timestamp, 'Drive', \
"Filename: " + str(filename) + ", " \
"Modified: " + str(timestamp)
listOfDrive.append(fileInfo)
return listOfDrive