How to copy folder in dos from hdd to usb

Last Updated: Feb 29, 2024 by

If you’re a Windows user, you may be familiar with the process of copying and moving files and folders using the graphical user interface (GUI). However, there may be times when you need to perform these tasks using the command line interface, also known as DOS (Disk Operating System). In this article, we’ll discuss how to copy a folder in DOS from your hard drive to a USB drive, as well as some other useful file management commands.

Why Use DOS for File Management?

While the GUI is generally more user-friendly and intuitive, there are some advantages to using DOS for file management. For one, it can be faster and more efficient, especially when working with large numbers of files. Additionally, DOS commands can be used in batch files, allowing you to automate tasks and save time.

Copying Folders in DOS

To copy a folder in DOS, you’ll need to use the xcopy command. This command allows you to copy files and folders from one location to another. The basic syntax for the xcopy command is as follows:

xcopy [source] [destination] [options]

In this case, the source is the folder you want to copy, and the destination is the location where you want to copy it to. Let’s say you have a folder called “Documents” on your hard drive, and you want to copy it to a USB drive with the drive letter “E:”. The command would look like this:

xcopy C:\Documents E:\

This will copy the entire “Documents” folder and all of its contents to the root of the USB drive. If you want to copy the folder to a specific location on the USB drive, you can specify the destination path after the drive letter. For example:

xcopy C:\Documents E:\Backup

This will create a new folder called “Backup” on the USB drive and copy the “Documents” folder into it.

Copying Subfolders and Files

By default, the xcopy command will only copy the specified folder and its immediate contents. If you want to copy all subfolders and files within the folder, you’ll need to use the /s option. This will copy all subfolders and files, including empty ones. The command would look like this:

xcopy C:\Documents E:\Backup /s

If you want to include hidden and system files in the copy, you can use the /h and /e options, respectively. The /h option will copy hidden files, and the /e option will copy empty folders as well.

Overwriting Existing Files

If you’re copying a folder that already exists in the destination location, you’ll be prompted to confirm whether you want to overwrite the existing files. To automatically overwrite any existing files without being prompted, you can use the /y option. This will suppress the confirmation prompt and automatically overwrite any existing files.

Copying Multiple Folders

You can also use the xcopy command to copy multiple folders at once. Simply list the source folders separated by spaces, and then specify the destination folder. For example:

xcopy C:\Documents C:\Pictures E:\Backup /s

This will copy both the “Documents” and “Pictures” folders to the “Backup” folder on the USB drive.

Other Useful DOS Commands for File Management

In addition to the xcopy command, there are several other DOS commands that can be useful for file management.

Moving Files and Folders

The move command allows you to move files and folders from one location to another. The syntax is similar to the xcopy command:

move [source] [destination]

This command will move the specified file or folder to the new location, deleting it from the original location. If you want to move multiple files or folders, you can use wildcards to specify a pattern. For example, to move all files with the extension “.txt” from the current directory to a new folder, you could use the following command:

move *.txt C:\Documents

Renaming Files and Folders

The ren command allows you to rename files and folders. The syntax is as follows:

ren [old name] [new name]

For example, to rename a file called “oldfile.txt” to “newfile.txt”, you would use the following command:

ren oldfile.txt newfile.txt

Deleting Files and Folders

The del command allows you to delete files, while the rd command allows you to delete folders. The syntax for these commands is as follows:

del [file name] rd [folder name]

To delete all files with a specific extension, you can use wildcards. For example, to delete all files with the extension “.tmp”, you could use the following command:

del *.tmp

Creating New Folders

The mkdir command allows you to create new folders. The syntax is as follows:

mkdir [folder name]

This will create a new folder with the specified name in the current directory. If you want to create a folder in a different location, you can specify the full path. For example:

mkdir C:\Documents\NewFolder

Tips for Using DOS Commands

While DOS commands can be powerful and efficient, they can also be dangerous if used incorrectly. Here are a few tips to keep in mind when using DOS commands for file management:

  • Double-check the source and destination paths before executing a command. A small typo could result in files being copied or moved to the wrong location.
  • Use wildcards with caution. If you’re not careful, you could accidentally delete or move more files than intended.
  • Always have a backup of important files before performing any file management tasks.
  • If you’re not sure what a command does, use the /? option to display the command’s help information.


While the GUI is generally the preferred method for file management, there are times when using DOS commands can be more efficient and effective. By using the xcopy command, as well as other useful commands like move, ren, and del, you can easily manage your files and folders from the command line. Just remember to use caution and double-check your commands before executing them. With a little practice, you’ll be a DOS file management pro in no time.

Gulrukh Ch

About the Author: Gulrukh Ch

Gulrukh Chaudhary, an accomplished digital marketer and technology writer with a passion for exploring the frontiers of innovation. Armed with a Master's degree in Information Technology, Gulrukh seamlessly blends her technical prowess with her creative flair, resulting in captivating insights into the world of emerging technologies. Discover more about her on her LinkedIn profile.