title: Backup USB to computer - Batch file
body: <p><br/>
  I'm trying to make a batch file that makes a backup of the USB stick that it is on, and places the copies of the USB files on the computer. It should do a few things: <br/></p>
  
  <pre><code>&gt;&gt;Make copies of all files and folders on the USB
  &gt;&gt;Reside on the top level of the USB stick (not in any folders)
  &gt;&gt;Nor should all the other files/folders have to reside in a folder 
  (which would be used to just copy that folder)
  &gt;&gt;Automatically chooses to overwrite any files that will be replaced
  </code></pre>
  
  <p>I tried to do this using XCOPY, although I ran into some problems. First, I'm not sure how to make the batch file copy all files from drive x. The USB may be plugged into the computer and be listed as drive G, H, E, X, Y, Z, whatever. So I can't just do </p>
  
  <pre><code>XCOPY "G:" "C:\Users\Backup" (usually I add /E and /I parameters)
  </code></pre>
  
  <p><del>The second issue with this approach is that I don't think there's any parameter which allows you to choose an automatic "overwrite all". It used to exist, but I think only in Win 2000. </del>
  <br/>
  I'm not very knowledgable about CMD, I've just used it occasionally to make other backup batch files, so I'm hoping someone here knows a way to overcome these obstacles. <br/>
  Thank you for any help,<br/> AJ</p>