Check if the file is completed (using python)

Is it possible to check if a file is being copied if its full use is python?
or even on the command line.
I manage files programmatically in a specific folder on mac osx, but I need to check if the file is complete before running the code that does the manipulation.

+3
source share
5 answers

If you know why the files are copied, you can check if the copy size has reached the size of the original.

Alternatively, if the file size does not change for a couple of seconds, it will probably be copied, which can be quite good. (However, it may not work well for slow network connections.)

+2
source

Unix/Mac OS X " ". flock, , , , ( , ). - ; , , .

+3

md5 , , , . , . md5 hashlib .

+3

, (python?), . ? , , , .

Is this program multithreaded or processed? If so, you can add file paths to the queue when they are complete, and then another thread will only act on the items in the queue.

+1
source

You can use lsof and analyze the list of open pens. If some process still has an open file descriptor (he writes), you can find it there.

0
source

All Articles