Skipping unchanged/unmodified files using Copy&Paste on Windows?

Did you ever try how to move a whole directory to a backup folder, skipping all files which were not changed? This can not be done with simple copy/paste in Windows GUI. However, Windows already has a solution to your problem.

xcopy to the rescue

You will have to use Windows CMD terminal. The entire process is very easy and straight forward. To make it even easier, I will divide those actions into steps (also works for network directories).

Step I – Open In Explorer src and dest directories.

Open in windows explorer both folders. Copy source folder directory and store it somewhere for a moment (open a simple text file of your choice). Now open destination folder and also copy folder path to a text file. We will need them shortly to set variables in Windows terminal.

Skipping unchanged/unmodified files on copy&paste on Windows

The paths might look line this:

src (localy):


dest (on the network):


Step II – Open CMD terminal

Open CMD (Windows terminal).

Skipping unchanged/unmodified files on copy&paste on Windows

Step III – Set the source and destination directory

Modify and paste the fallowing script (make sure to change Source and Target directory path to what ever you want to move):


Step IV – Start data migration

xcopy %SourceDir% %TargetDir% /e /h /c /i /d /y
Skipping unchanged/unmodified files on copy&paste on Windows

Step V – Clenup

Now clean the variable just in case you would rerun the command and forgot to modify one of the variables. Always do that after your data migration was completed.

set SourceDir=
set TargetDir=

xcopy modifiers

  • /d – Copies source files changed on or after the specified date only. If you do not include a MM-DD-YYYY value, xcopy copies all source files that are newer than existing destination files. This command-line option allows you to update files that have changed.
  • /e – Copy subdirectories, including any empty ones.
  • /h – Copy files with hidden and system file attributes.
  • /c – Continue copying even if an error occurs.
  • /i – If source is a directory or contains wildcards and destination does not exist, xcopy assumes destination specifies a directory name and creates a new directory. Then, xcopy copies all specified files into the new directory. By default, xcopy prompts you to specify whether destination is a file or a directory.

PowerShell instead of Windows CMD

Note that you could also use it with in powershell. Then your commands would look as fallow:

xcopy $SourceDir $TargetDir /e /h /c /i /d /y

Alternative solutions

Features comparison xcopy vs robocopy

Note that you could also use robotcopy instead of xcopy. This is slightly newer version of xcopy providing you with new flags and capable of returning more information about the process.

The other solution would be to use rsync, which is a Linux tool not available by default in Windows CLI. This might not be an issue since we can use Cygwin! Which will let us use many of the Linux features on a Windows machine.

You could use rsync in WSL if both folders are placed with the same machine as WSL will not mount Windows network drives, therefore they will not be visible / accessible from WSL system.

xcopy docs
robocopy docs
Mounting network drive to WSL
Mount network drive to WSL
Mounting drive in WSL permanently
Difference between xcopy & robocopy

Would love your thoughts, please comment.x