Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

copy all files and folders from one drive to another drive using DOS (command prompt)

i want to copy all files and folders from one drive to another drive using MS-DOS. How to do it?

I am trying xcopy I:\*.* N:\ But it copies only files, not folders. So how to copy all files and folders both?

Thanks.

like image 523
gautamlakum Avatar asked Aug 24 '11 05:08

gautamlakum


People also ask

How do I copy files from one drive to another using Command Prompt?

Using the xcopy commandxcopy /h /c /k /e /r /y c:\ d:\ Copy hidden and system files. Normally xcopy skips these files, but if you specify this option, they are copied.

How do I copy an entire directory in DOS?

To copy a directory in MS-DOS, use the xcopy command.

How do I copy a folder and subfolders in cmd?

Type "xcopy", "source", "destination" /t /e in the Command Prompt window. Instead of “ source ,” type the path of the folder hierarchy you want to copy. Instead of “ destination ,” enter the path where you want to store the copied folder structure. Press “Enter” on your keyboard.


Video Answer


2 Answers

xcopy "C:\SomeFolderName" "D:\SomeFolderName" /h /i /c /k /e /r /y 

Use the above command. It will definitely work.

In this command data will be copied from c:\ to D:, even folders and system files as well. Here's what the flags do:

  • /h copies hidden and system files also
  • /i if destination does not exist and copying more than one file, assume that destination must be a directory
  • /c continue copying even if error occurs
  • /k copies attributes
  • /e copies directories and subdirectories, including empty ones
  • /r overwrites read-only files
  • /y suppress prompting to confirm whether you want to overwrite a file
  • /z Copies over a network in restartable mode.

more flags are found here https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy

like image 81
SHABAZ KHAN Avatar answered Sep 28 '22 05:09

SHABAZ KHAN


Use xcopy /s I:\*.* N:\

This is should do.

like image 34
Yahia Avatar answered Sep 28 '22 04:09

Yahia