Wednesday 14 January 2015

use xcopy command to copy to another folder without prompting to overwrite existing files

Let's say you want to copy files (which don't change) to another folder on your network as a backup. And you want to automate this process daily for example so that you won't have to manually copy the new files to the backup folder.
Thanks to the xcopy command and task scheduler, windows has the built-in tools to do this.

First create the batch file by right-clicking on the desktop and creating a new txt file. Then enter the following command, customizing to your needs:

echo n|xcopy "C:\Users\DonaldDuck\my files\*.*" "Z:\my files" /d/i/e

echo n| makes xcopy skip the 'do you want to overwrite the file' if it already exists on the destination
/d copies files whos source time is newer
/i assumes destination is a directory
/e copies subdirectories
more xcopy parameters at Microsoft

Save the text file and rename file extension from 'txt' to 'bat'
Under Administrative Tools in the Control Panel, create a task in the Task scheduler by following the instructions.
Under General choose a name for the task, choose the time of day under 'Trigger'. Under the 'Actions' tab, choose the location of the previously created batch file (with the xcopy command). Select Conditions and Setings and hit OK.
This is a good way to backup new files that you create or download from the internet but which don't change in content. To backup files which change in content, such as spreadsheets, text documents and photos that you edit, Windows 8.1 has a function called 'File History' that if turned on will automatically backup your files to a folder (preferably other than your local hard drive) that you specify.

Source: Thanks to TheFunPolice on Experts Exchange who found this command line