Cancel a stalled file copy in Python in Linux

41 Views Asked by At

Is there a way of cancelling a file copy if, after a while, the copy is stalled and there is no progress?

I'm using shut.copy to copy files from one directory to another. The problem is that there are certain files that are corrupted and, when trying to copy them, the process gets stalled.

I would like to know if there's a way of identifying that the copy is not progressing and cancel the copy. Otherwise, would make sense to use subprocess.TimeoutExpired?

0

There are 0 best solutions below