Jump to content

Code for CMD file to copy folder and contents to other Drive


Recommended Posts

Posted

If i have a folder path of C:\folder A\folder B\my folder what line could i use in a CMD file to copy 'My Folder' and all its subfolders and files to the root of C:\ ?

 

COuld someone give me ideas?

Posted

 
copy "C:\folder A\folder B\my folder\*.*" c:\myfolder

 

*.* denotes everything or you could say all word docs like *.doc . * is used as a wild card. A more robust copy command is Robocopy which you can download.

Posted

The /s is redundant when there is already an /e.

Also in that example unless you specify a destination folder the files will be copied to the root of the c: drive.

 

Try something like this

 

xcopy  e:\source_folder f:\destination_folder /e /i /h

 

The /h is just in case there are hidden files. The /i creates a destination folder if there are muliple source files.

  • 6 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...