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.
The paths might look line this:
D:\_GRAPHIC WORK\ACTIVE PROJECTS\MALIODKRYWCY
dest (on the network):
\\DESKTOP-BC\D Desktop_GRAPHIC WORK\ACTIVE PROJECTS\MALIODKRYWCY
Step II – Open CMD terminal
Open CMD (Windows terminal).
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):
set SourceDir="D:\_GRAPHIC WORK\ACTIVE PROJECTS\MALIODKRYWCY"
set TargetDir="\\DESKTOP-BC\D Desktop\_GRAPHIC WORK\ACTIVE PROJECTS\MALIODKRYWCY"
Step IV – Start data migration
xcopy %SourceDir% %TargetDir% /e /h /c /i /d /y
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=
- /d – Copies source files changed on or after the specified date only. If you do not include a MM-DD-YYYY value,
xcopycopies 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,
xcopyassumes destination specifies a directory name and creates a new directory. Then,
xcopycopies all specified files into the new directory. By default,
xcopyprompts 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:
$SourceDir="D:\_GRAPHIC WORK\ACTIVE PROJECTS\MALIODKRYWCY"
$TargetDir="\\DESKTOP-BC\D Desktop\_GRAPHIC WORK\ACTIVE PROJECTS\MALIODKRYWCY"
xcopy $SourceDir $TargetDir /e /h /c /i /d /y
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.