By Ivy / Last update December 13, 2021

Copy only newer files with XCopy or Robocopy, or use easier ways:

Want to use XCopy to copy only new or modified files 

Xcopy is a command line utility for copying multiple files or entire directory trees from one directory to another and for copying files across a network. Also, you are allowed to copy only new or changed files with it. And it is used in Windows 7/8/10/11/XP/Vista and Windows Server 2003/2008/2012/2016/2019/2022.

Copying only changed files with XCopy saves much time and disk space, thus many users are willing to only copy updated files. Below is an example from it.

“ I copy my files from Windows 7 to Server 2008 with the following command, but it copies everything.

xcopy C:\source X:\destination /s

I just want to use XCopy command to copy only newer files, because these files are very large. It’s time-consuming.

Is there a way to specifically just copy new or updated files without specifying a date? Any suggestion will be appreciated.”

XCopy copy only newer files step by step

Before using XCopy to copy only changed files, you need to learn the syntax and some parameters you will use.

Syntax of XCopy command line:  

Xcopy [source] [destination] [/w] [/p] [/c] [/v] [/q] [/f] [/l] [/g] [/d [:MM-DD-YYYY]] [/u] [/i] [/s [/e]] [/t] [/k] [/r] [/h] [{/a | /m}] [/n] [/o] [/x] [/exclude:FileName1[+[FileName2]][+[FileName3]] [{/y | /-y}] [/z] [/b] [/j]

Options: 

  • /S  Copies directories and subdirectories, unless they are empty. If you omit /s, xcopy works within a single directory.
  • /Y Suppresses prompting to confirm that you want to overwrite an existing destination file.
  • /I   If in doubt always assume the destination is a folder. e.g. when the destination does not exist.
  • /E  Copy folders and subfolders, including Empty folders.
  • /D:mm-dd-yyyy  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. 
  • For more options, you can type xcopy /? for all the help or refer to xcopy command in Microsoft.
★Tips: To copy only updated files with XCopy, you have two options, namely using /s /d, or /i /d /y. And there are something you need to be aware:
This first option will copy files that does not exist in the destination folder if you use /d parameter without specifying a date. To avoid it, you could add the /u  switch.
The second option will ignore the new directories by default. To copy everything, including new directories, you should add the /e switch.

Now, see below and learn the detailed steps. Note that if there are spaces in your directory names, you need to use quotes.

Step 1. Type cmd in the search box and select it.

Step 2. Use XCopy to Copy only updated files with corresponding commands. Please remember to hit Enter after each one. 

#1: Copy only updated files that are not in the destination folder, type the following commands. 

set SourceDir=D:\Source

set TargetDir=K:\Target

xcopy %SourceDir% %TargetDir% /s /d

#2: Copy only changed files without new directories,  type the following commands. Please remember to replace “D:\Source” and ”F:\Target” with the path of your files.

set SourceDir=D:\Source

set TargetDir=K:\Target

xcopy %SourceDir% %TargetDir% /i /d /y

Xcopy Copy Only Newer Files
Xcopy Command Copy Only Newer Files

#3: Copy changed files already exists in the destination path, type the following commands: 

set SourceDir=D:\Source

set TargetDir=K:\Target

xcopy %SourceDir% %TargetDir% /s /d /u

#4: Copy everything including the new directory, type the following commands. Please remember to replace the following path “D\My Source\stuff” and ”F:\My Backup\stuff”.

Set SourceDir=”D:\Source\copy files”

Set TargetDir=”K:\Target\files copied”

xcopy %SourceDir% %TargetDir% /i /d /y /e

Copy Everything
Copy Everything

Step 3. Type exit and hit Enter to leave this window.

Robocopy copy only new files step by step 

Robocopy can also help you copy only new files, but it has more options than Xcopy and is considered as a good alternative. Before you use it, please learn the syntax and options you may use. 

Syntax of Robocopy command line: 

robocopy [source] [destination] [[file][ ...]] [options]

Options: 

  • /XO:  is used to exclude older files, and usually done with the parameter"/maxage: n".
  • /maxage: n:  indicates that the farthest modification time or the specific date, the file whose modification time or date is older than this will not be copied.
  • /XC: Exlude changed files.
  • /XN: Exlude newer files.
  • /XD dirs [dirs]:  Exlude directories mathcing given names and paths.
  • /S: Copy subdirectories, excluding empty ones
  • /Z: Restartable mode
  • /fft: Make the modify time comparison more tolerant(2 seconds granularity)
  • /Mir: Mirror a directory tree
  • For more options, you can type robocopy /? for all the help or refers to Robocopy command in Microsoft.
★Tips:
 To copy only changed files with Robocopy, you have two options, namely using maxage: n or /XO /maxage: n. 
Some users say that they don't want to create all the subfolders on the target disk if there is no new files in them. In this case, you need to add extra switch /S to exclude the empty folder.

Then, let's go through the following steps to copy only new files:

Step 1. Open the command prompt with administrator priority.

Step 2. Use Robocop to copy only newer or added files with corresponding commands. Please remember to hit Enter in order.

#1: Copy only newer or added files, type the following commands:

robocopy D:\folder1  E:\folder2  / maxage:7 or robocopy D:\folder1  E:\folder2  /XO /maxage:7

Robocopy Copy Only New Files
Robocopy Copy Only New Files

#2: Copy new files while excluding an empty folder, type the following commands.

robocopy D:\folder1  E:\folder2  /s /maxage:7 or robocopy D:\folder1  E:\folder2  /XO /s /maxage:7

How to copy only newer files easily without XCopy or Robocopy

As for you can see from above, whether using XCopy or Robocopy, you need to learn the syntax and some parameters, and none of them is easy for home users. Well then, is there any way to copy only changed or new files? 

The answer is Yes, you could use a professional file sync or backup software like AOMEI Backupper Server. It provides you 2 easier ways to complete this task in Windows 7/8/8.1/10/11/XP/Vista, namely using Sync or File Backup features.

The previous one keeps these files just as in the original folder, you can easily access or use them after syncing. While for the latter one, it adds an extra layer of your files by compressing them to an image files, greatly reducing any unwanted access and the risk of files being corrupted or modified. Select one per your needs. 

Sync only new or modified files just as it was 

Here you will use the Sync feature to sync only changed files. It has 4 sync options and comes along with helpful features, such as, daily, weekly, month schedule sync. And all of them has its own features, you can check details in the following box. 

  Basic Sync Real-Time Sync Mirror Sync Two-Way Sync
Sync newly added or changed files.      Yes             Yes       Yes          Yes
Sync deleted files from source folder to destination folder automatically.      No             Yes       Yes           Yes
Sync changed files in real time.      No             Yes         No           No
Deleted newly added files or undo changes made in the destination folder.      No             No        Yes           No
Sync changes from source folder to destination folder, and vice versa.      No             No       No           Yes
Support schedule sync: daily, weekly, monthly, event triggers, USB plug in.      Yes             No        Yes            Yes

Then, go to the Sync tab and copy only newer files with one of them. Here Take Basic Sync as an example. 

Step 1. Download AOMEI Backupper Professional, install and launch it. Then, prepare an external hard drive or other storage as sync destination and connect it to your computer.

Download Free Trial Win 11/10/8.1/8/7/XP
Secure Download

Step 2. Go to the Sync tab and select Basic Sync.

Basic Sync
Basic Sync

Step 3. Click Add Folder to select folders containing all the files you want to sync. Then, select the sync destination by clicking the folder-shaped button below.

Add Folder
Add Folder

Step 4. Click Schedule and Enable Schedule Sync, then select Daily, Weekly, or Monthly. To set the sync task more precisely, you can specify the backup time or intervals in the following.

Daily Sync
Daily Sync

In addition, you can still enjoy other helpful features:

  • Event triggers: It helps when you want to sync files at system shutdown, system startup, user logon or user logoff. 
  • USB plug in: It makes syncing files between computer and flash drive flexibly, you just need to connect the USB drive when you want to sync changed files.
  • Wake the computer to run scheduled tasks: It allows you to wake up computer 2 minutes before the scheduled task start, without human intervention required.
  • Reconfigure the operation after the scheduled tasks: You can shut down restart your computer after syncing, or simply put it into sleep or hibernate mode.
  • Sync the deletions in source directory to destination: By checking it in the Options, you can sync the deleted files as well.

Step 5. Confirm the operation and click Start Sync to sync all the files to the destination folder. Then, it will sync changed files at the next time.

Copy only New or Changed Files
Copy only New or Modified Files

 

Safer way to copy only new or modified files

Except for Sync feature, you still can complete this task with the help of File Backup. It comes along with daily/weekly/monthly schedule backup as well as incremental or differential backup. By using it, you can still set precise backup time and intervals. 

They are based on full backup, but not exactly the same. For differences, you can see from the comparison chart below.

  Full Backup Differential Backup Incremental Backup
Backup Speed Slowest Moderate Fastest
Storage Space Most Moderate Least
Restoration Speed Fastest Moderate Slowest

Also, if you want to backup files during off-peak hours, you can wake computer from sleep or hibernate mode before the scheduled tasks start. And you can Reconfigure the operation after scheduled tasks, to shut down or restart your computer or put it into sleep or hibernate mode.

In the long run, you may worry about the backup disk full oneday. Fortunately, you can avoid this issue by deleting old backup image regularly with its Backup Scheme feature. Normal or High compression level, Intelligent sector backups also help with this. Then, see below and learn the specific steps.

Step 1. Go to the Backup tab and select File Backup.

File Backup
File Backup

Step 2. Click Add File or Add Folder to select the files or folders you want to backup and then click OK. Then, select the prepared storage device to store your image.

Add File or Folder
Add File or Folder

Step 3(Required). Click Schedule and select Daily, Weekly, Monthly. Then, click Backup Scheme and select Incremental Backup or Differential Backup under the backup method option. 

Schedule Settings General
Schedule Settings General

In addition, you can manage the backup task with more helpful features.

  • USB plug in: To backup your files flexibly and take them everywhere, you can create a schedule backup with "USB plug in" feature. It does not require any human interference.
  • Normal or High compression level: It is able to compress image file with a smaller one, thereby saving disk space. Note the high compression level requires more backup time.
  • Intelligent sector backup: It only backs up the used sectors of the file system,
  • Backup Scheme: It offers you 3 options to delete backup files, including By quantity, By time and By daily/weekly/monthly. 

Step 4. After that, confirm all the selected settings and click Start Backup. It will backup your files immediately and then backup only changed files at the next time.

Bonus tip

Reading here, you may know how to copy only newer files with XCopy or its alternative Robocopy. To be honest, both of them are not suitable for common users. They rarely touch the command line, let alone use it properly.

Thus, it's wise to copy the changed file with Sync or File Backup feature of AOMEI Backupper. And both features come along with many useful features to complete this task smoothly. You need to know that the Sync feature keep all the files as it was while the File Backup feature compresses them to an image file, significantly enhance the security. 

Believe me, it's one of the most powerful software to protect your data with its complete solution. To copy files from server to server within one company, you could use AOMEI Backupper TechPlus. Please download it to have a try right now!