- Worldstart's Tech Tips And Computer Help - http://www.worldstart.com -

Copying Files Using DOS

Posted By Andrew On December 27, 2010 @ 11:02 AM In File & Disk Management | Comments Disabled

Marvin from South Bend, IN asks:

Rather than using backup discs, I use external drives for faster access. Each external drive contains different, specific, files within folders. Cleaning my system means copying from C:\drive onto one of four external TB drives; some transfers take 60-minutes: “copy from” and “copy to …” I have added new files to copy into existing folders and I have no idea whether or not newer files were copied into any of many existing folders. The only verification is “manual” and I want to avoid adding more time doing manual (visual) verification. The long and short of it all: What is the DOS command to copy files to an existing folder, but ONLY copy newer files instead ?

It’s great to know there are some people still hooked on DOS. I too use it for tasks that would otherwise be a nightmare to accomplish using the Windows GUI.

Now, to answer your question, the DOS command that you are looking for is xcopy. Through this command, you can customize the copying of files in a number of ways. In your case, you need to copy new files into a folder. For this, the xcopy command has the /d option, which lets you specify the date. To access the Windows Command Prompt, where the following commands are entered, hold the Windows key and hit the R key (Win+R). This will open Run. There, you type cmd and then hit the Enter key, and the Command Prompt will open.

To understand how to use this xcopy with the /d option, let’s take an example. The following screen shot shows some files in my D drive. I want to copy the file created after 10/23/2010 into the babyphotos folder in my C drive.

image

As you can see from the screen shot, there are many files to copy. By using the xcopy command, you can achieve the task in one shot. The syntax for the xcopy command is:

xcopy /d:date

In this syntax, the <<strong>source> argument means the source directory of the files you want to copy and the <<strong>target> argument means the destination directory, i.e. the folder where you want to copy them to.

Now, let’s put the xcopy command to the test. The following screen shot shows the output of the command.

image

As you can see, five files were copied. These were created on or after 10/23/2010. If the files you are trying copy already exist in the destination folder, you will be prompted to overwrite the file in the source directory.

When you use this command, do remember that in the days of DOS, spaces in directory or folder names were not allowed. Therefore, the xcopy command does not support them. You will get an error as shown below:

image

The xcopy command has a number of other options that might be useful for you in the future. To learn more about them, access the DOS help by typing help xcopy.

~Rupen Sharma


Article printed from Worldstart's Tech Tips And Computer Help: http://www.worldstart.com

URL to article: http://www.worldstart.com/copying-files-using-dos/