Skip to content

Instantly share code, notes, and snippets.

@serhiy-storchaka
Created January 29, 2020 11:28
Show Gist options
  • Save serhiy-storchaka/6ccd80d46494a1099a192e4fa20af861 to your computer and use it in GitHub Desktop.
Save serhiy-storchaka/6ccd80d46494a1099a192e4fa20af861 to your computer and use it in GitHub Desktop.
Copy files using sendfile
import sys, os
with open(sys.argv[1], 'rb') as src:
with open(sys.argv[2], 'wb') as dst:
size = os.stat(src.fileno()).st_size
os.sendfile(dst.fileno(), src.fileno(), 0, size)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment