I want to copy a list of files on windows using python. When doing that manually, I see timeouts in some files, therefore the copy process fails. I need a way to implement the timeout check in python.
So far I use the win32 API:
import win32file
files = {'source_a' : 'dest_a', 'source_b' : 'dest_b'}
for f in files.keys():
win32file.CopyFileW(f,files[f],0)
CopyFileW
Instead of CopyFile
, use CopyFileEx
which provides an interface that supports cancellation.