Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import os
- SOURCE_FILENAME="/tmp/2.png"
- TARGET_FILENAME="/tmp/3.png"
- source_size = os.stat(SOURCE_FILENAME).st_size
- copied = 0
- source = open(SOURCE_FILENAME, 'rb')
- target = open(TARGET_FILENAME, 'wb')
- while True:
- chunk = source.read(32768)
- if not chunk:
- break
- target.write(chunk)
- copied += len(chunk)
- print '\r%02d%%' % (copied * 100 / source_size),
- source.close()
- target.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement