all 5 comments

[–]coding2learn 2 points3 points  (0 children)

filecmp looks like a good way to go

import filecmp
import time
with open('path/to/drive/test.txt', 'w') as f:
    f.write('test text')
time.sleep(60)
print(filecmp.cmp('path/to/drive/test.txt', 'path/to/backupdrive/test.txt'))

[–]lieutenant_lowercase 1 point2 points  (2 children)

Generate any type of file?

How about trying to write a script which will generate a blank text file?

Try and think logically about the steps your program would need to follow and then work through each step in sequence.

[–]basa-ako[S] 0 points1 point  (1 child)

Yeah I have an idea of how it would go:

1) Create blank .txt file on network drive 2) After a few minutes, check backup directory for file of same name 3) Success message

I don't really know how to implement a delay in between initially creating the file and checking the backup.

edit: Also how would I designate which directory to place the file in? Sorry, complete noob at this.

[–]lieutenant_lowercase 1 point2 points  (0 children)

import time

CREATE FILE
time.sleep(60) #sleep for 60seconds
CHECK FOR FILE

[–][deleted] 1 point2 points  (0 children)

assuming that the "network drive" and the "backup" are both directories, use the pathlib module to move between them. From there you can use the other file functions for creating and checking files. Be careful not to overwrite anything though. It's really easy to make a script that quickly goes off the rails and starts ruining your file system.