How to Copy files from one Directory to another using CMD?

In this digital world, When everyone is moving towards CLI. People want to share files and directories using the command prompt or “cmd“, which helps them to share files easily and faster. Many people are stuck in it, because of a lack of knowledge in CLI. This article will help you to get rid of the challenges faced while copying files and interacting with the “Command Line Interface”.

How to Open a Command Prompt?

There are many methods available to open a command prompt on the Windows operating system. Some of them are given below.

Method 1: Through Run Command

Step 1: Press the Windows key and R to open the run command.

Step 2: Type the “cmd” in it, then press “Enter”. Your command prompt will open.

Open a Command Prompt – 01

Method 2: Through Search Bar

Step 1: Open search Bar or press the windows key.

Step 2: Type “Command Prompt“.

Open a Command Prompt – 02

Step 3: Now click on Command Prompt to open it.

Method 3: Through Mouse

Step 1: Go to the Desktop or press Windows key and D.

Step 2: Right Click and click on Command prompt.

Open a Command Prompt – 03

How to Copy Files From One Directory to Another?

After opening the command prompt you have to follow the below steps to copy file from one directory to another.

Step 1: Go to the file destination though cd command or open cmd in that directory.

Step 2: Now Type “dir” command to see the list of files available in that directory.

Copy Files – 01

Step 3: Now type the following command and replace <filename> with your actual file name and <destination> with where you want to paste the file.

copy <filename> <destination>

Copy Files – 02

Note: If you try to copy file to C: drive, so it does not work if you have not open command prompt “Run as Administrator” permission.

How to Copy Multiple Files from One Directory to Another?

To copy multiple files simultaneously, we have another command and many option associated with it. Follow the bellow steps to copy all files and directories to another directory or drive.

Step 1: Make sure you have administrator access to run these command.

Step 2: run the following command to copy from one directory to another. Replace <source> and <destination> with current directory location from where you want to copy and location where you want to paste.

xcopy <source> <destination> /s /e

Copy Multiple Files – 01

Available Options

Parameters

Description

<source>

Give you the file name and location of the file you want to copy.

<destination>

Give you the directory name and location of the destination where you want to paste the file.

/w

Display the message and wait for your response.

Press any key to begin copying file(s)

/p

It will ask you where you want to create a destination file.

/c

It specifies to ignore the error if occurs.

/v

It will verify each file is same as the source and destination file.

/f

displays the source and destination of the each file.

/g

Generate a list of files to be coppied.

/s

copies the directory and sub-directory unless it is empty.

/e

Copies all subdirectories does not check whether they are empty or not.

/r

It will copy only read-only files.

/h

copies hidden files.

/z

Copies over a network in restartable mode.

/?

Display the help.

Conclusion

In conclusion, copying file or directory from one place to another is very easy using “Command Prompt“, and it saves your time and effort. Knowledge of CLI and command prompt will be beneficial not only for your time, but also get the good opportunity in carrier grouth. This will help you to manage file system using cmd and command.

Also Read

How to Copy Files From One Directory to Another Using CMD – FAQs

How do I open a Command Prompt?

There are many method availble to open a cmd, through run command, by right clicking on desktop and type command prompt in search bar.

Is their any difference between copy and xcopy?

Yes, copy only coppies one file on the other hand xcopy copy multiple file with directories at the same time.

How can I copy multiple files from one directory to another?

Ensure you have administrator access.

Use the command “xcopy <source> <destination> /s /e” .

Why may I encounter issues when copying files to the C: drive?

Copying to the C: drive may require administrator privileges. Ensure you run Command Prompt with “Run as Administrator” permission to avoid issues.



Contact Us