Created
January 29, 2020 11:28
-
-
Save serhiy-storchaka/6ccd80d46494a1099a192e4fa20af861 to your computer and use it in GitHub Desktop.
Copy files using sendfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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