If you need to copy an entire directory to a new destination in Windows,
you can use
xcopy. This guide will show you how to use
to recursively copy a directory, all of its subdirectories, and
include hidden files. We will also look at how to remove a directory with
rmdir and move a directory with
Recursively copy a directory
The command to recursively copy in Windows command prompt is:
xcopy some_source_dir new_destination_dir\ /E/H
It is important to include the trailing slash
\ to tell xcopy the destination
is a directory.
The two options are also important:
/E- Copy all subdirectories
/H- Copy hidden files too (e.g.
You can see more options by running:
Move a directory
To simply move a directory instead of copying it, use the
move some_directory new_directory_name
Remove a directory
To remove a directory and all of its contents, you can use
rmdir some_directory /Q/S
The important options are:
/Q- Do not prompt with "Are you sure?"
/S- Delete all contents and sub-directories
rmdir /? for more help.
You should now know how to recursively copy a directory including hidden files
in Windows using
xcopy, delete a directory using
rmdir, and move a directory