How to use xcopy in windows.

These are the common case to use XCopy in windows.

Copy folders and subfolders using Xcopy command in Windows:

To move folders and subfolders in cmd, the most used command syntax would be:

xcopy [source] [destination] [options]

1. copy folders and subfolders and contents

Xcopy C:\test D:\test /E /H /C /I

  • /E – Copy subdirectories, including any empty ones.
  • /H – Copy files with hidden and system file attributes
  • /C – Continue copying even if an error occurs.
  • /I – If in doubt, always assume the destination is a folder. e.g. when the destination does not exist.

2. copy folders and subfolders without files

You can open the Command Prompt according to the steps shown above. Then, type the Xcopy command as below to copy folders and subfolders without files:

Xcopy Source Destination /T /E

  • /T – Copy the subdirectory structure, but not the files.
  • /E – Copy subdirectories, including any empty ones.

 

Leave a Reply