I have some photos and some videos that I have to copy them in another folder without using shutil
and os.rename
. I can’t use shutil and os.rename because this is a condition for that Python exercise. I tried open
but it only worked for text and not photos and videos.
open file in binary mode, and write in binary mode
original_file = open('C:\original.png', 'rb') # rb = Read Binary
copied_file = open('C:\original-copy.png', 'wb') #wb = Write Binary
copied_file.write(original_file.read())
original_file.close()
copied_file.close()