0

I'm working on a project of mine. I want to copy a folder or file from a computer to my say USB stick. something along the lines of

    Original = open("Original.txt", "r")
    Copy = open('Copied.txt','w')

Just what do I add to make this run.

Let me just go into more depth here:

say I have a computer with a file on it, I know the file name and want to take it from the computer and save it on the USB stick that I inserted.

how do I tell my computer where to safe file and how do I load it.

LenRed na
  • 3
  • 1
  • 3
  • 2
    take a look at your recommended/related questions. The answer is [here.](https://stackoverflow.com/questions/123198/how-do-i-copy-a-file-in-python?rq=1) – Paritosh Singh Dec 03 '18 at 16:33

1 Answers1

0

You can use the shutil module to copy files.

import shutil
shutil.copy(src="C:/Test/Original.txt", dst="F:/Original.txt")  
# This copies the same file from SRC (Source) into the DST (destination) USB (say F: drive) while retaining the filename.
ParvBanks
  • 1,316
  • 1
  • 9
  • 15