Reputation: 5769
I'm looking for some help to do:
1) Get the modification date/time of a file
2) Compare against the same file after a sleep of 10 minuites and if it's not different to play a beep:
import winsound
winsound.Beep(2000,500)
Any ideas?
Upvotes: 0
Views: 100
Reputation: 838
You will be able to use below function with some modification to fit your requirements:
def getnewestfile(NetworkPath):
DestFolder = os.getcwd()
os.chdir(NetworkPath)
filelist = os.listdir(os.getcwd())
filelist = filter(lambda x: not os.path.isdir(x), filelist)
newest = max(filelist, key=lambda x: os.stat(x).st_mtime)
os.chdir(DestFolder)
return newest
This function returns the newest file located at the network path as input.
Upvotes: 3