How-To: Synchronise two folders using xcopy.
The main reason you may want to sync folders on a single machine is to backup your data. You would probably be best to find a backup utility to do this.
RoboCopy does a one-way sync (from Left → right folder) RoboCopy’s Mirror copy mode (/MIR) is similar to Microsoft SyncToy‘s “Echo” feature. Remember, RoboCopy does only left → right synchronization — NOT a two-way synchronization. Robocopy is hanging in the corner of your PC, maybe without you ever noticing it. It is a built-in command line for Windows operating systems that allows for quick file transfers from one place to.
Apple's developer guidelines currently say that apps on the watch should be designed to be used for a few seconds at a time. The watch's battery is considerably smaller than batteries in phones, so longer activities will quickly run the battery down. For this reason, we're not sure Anki is a great fit for the watch in its current implementation. Power4 Watch Charger for Apple Watch Charger,iPhone iWatch Charger MFi Certified Upgraded Magnetic Wireless Portable Charging Cable Cord Compatible with Apple Watch Series Se 6 5 4 3 2 1-White. 4.8 out of 5 stars 2,749. 50 $12.99 $12.99. Lowest price in 30 days. Apple watch ankle monitor.
If you want to sync folders over networked drives, this guide may help you also. There are more detailed articles at Inspect My Gadget on syncing documents between two networked computers. Find them here.
On the very odd occasion you do want to sync folders on a single computer, it is not too hard to achieve. There are number of applications available to help you do this, but many of them cost money. Windows has a solution by a command in the command prompt which will work on all Windows PC’s. Microsoft also offers a program called SyncToy which does the same thing with a nice GUI interface.
This is a two part article. Part 1 will look at using xcopy to sync your folders, and Part 2 will look at using SyncToy.
Part 1 will cover the following topics.
- How to use xcopy
- How to put xcopy into a batch file
- How to schedule the batch file to run a sync at a set time.
The reason I like xcopy is that it is quick to setup, and you do not require any additional software to get it to work. This means it is good for 1 off syncs. SyncToy will be the best solution for most people who require to sync more frequently.
This two part article was originally going to be much shorter, but I got typing and my fingers wouldn’t shut up. I recommend that beginners read the entire article to prevent disaster and to get all the extra information. Advanced users will probably be able to skim through most of it, wary that a typing error may result in lost data.
I am generally a big fan of off-line files for smaller syncs over networked drives. This does not work with two folder on a single computer, so we have to look at other methods. The advantage of off-line files is that the data on both computers, while the computers are connected, will be the same even if a sync has not taken place recently.
With the methods in this article, the folders will only be the same after a sync which you have scheduled to run, or by running the sync manually. I am not aware of any applications which will recognise changes as they are made and force a sync at that time.
It is very important before you play with this, that you backup your data as you may need to do a little tweaking to get it working right for you. You may overwrite files with wrong versions if you make a typo. This is particularly important with xcopy. The easiest way to backup your data is to use Windows File Explorer to copy your files to a safe place. I can’t be held responsible for lost data. Do this at your own risk.
A bit of information about XCOPY:
Xcopy is an MS-DOS command which expands on the normal copy command, giving you a thorough list of switches to help you get it to work just as you want. The advantages of the xcopy command over the copy command is that it lets you copy only updated files, by a entering a series of switches. The copy command will copy the whole directory and prompt you if files need to be overwritten.
For most backup purposes, you only need to go one way. One of your folders will be a work folder(source) and another will be the backup folder(destination). As new files will not be created in the backup folder, you do not have to sync the backup folder back to the source folder. If you do need to Sync both ways, just run the command twice, switching the source and destination folders the second time. This will be covered further in this article.
Play with XCOPY:
The best place to start is to open up a command prompt by clicking on “Start”, selecting “Run”, and typing in “cmd” followed by enter. If you are using Vista, you can type “cmd” directly into the search box followed by enter. Either way, you should end up with a command prompt.
type “xcopy /?” followed by enter
Add-ons for Anki 2.0 Support for downloading 2.0.x add-ons inside Anki ended on Feb 1 2020. Add-on authors are no longer able to update the 2.0 version of their add-ons, so these downloads are provided as an archive, and without any support. Anki is a program which makes remembering things easy. Because it's a lot more efficient than traditional study methods, you can either greatly decrease your time spent studying, or greatly increase the amount you learn. Please see here.here. Anki2. Various ANKI2 openers. These apps are known to open certain types of ANKI2 files. Since many different programs may use ANKI2 files for different purposes, you may need to try a few of the apps to open your specific ANKI2 file.
This will show you all of the switches you can play around with. I will be using the /D and /E switches only in this article. You can feel free to play with the others, though I have not needed them myself. Just take caution, this is where you can stuff up your data if you have not backed up.
The /D switch copies all the files from your source to your destination, unless a file at your destination is newer than the source. If there is a newer file at the destination, that file will be skipped and the next file will be checked. The copying of a file will only take place if the destination file does not yet exist or is older than the source.
The /E switch tells xcopy to include folders and subfolders. If you do not include this, only the files in the root of the folder will be copied. Worth noting is /S which will copy all folders across apart from empty folders. /S can be used instead of /E
There will NOT be any prompts asking you if you want to overwrite files using only the /D switch. Xcopy will overwrite the file in the destination if the source file is newer. There is no easy way to recover the file in XP or Vista. If you are a Vista user, you may get lucky by using the “Previous Version” functions in folders properties.
Sync with XCOPY:
The command “xcopy folder1 folder2 /D /E” will copy all the folders and files from folder1 to folder2. If a file exists in folder 2 that is newer or the same as a file in folder 1, the file will not be overwritten.
So to do it both ways, you can do as above and then the command “xcopy folder2 folder1 /D /E”. This will copy any folders and files that are new or don’t exist in folder1 across to folder1.
Both folders will now be the same.
Setting up a batch file:
You can place batch files anywhere on your computer, but for once I will recommend putting it in the root of your C: drive. If you want to create multiple files, create a folder called “sync” or “batch” to keep it tidy.
Open up Notepad, it’s in you accessories folder in the start menu.
You don’t need to make the batch file very complicated. If you have multiple syncs, you can put them all in the once batch file.
Start small with some test folders to be safe. Please don’t start off syncing your photos or music on your first run.
Put in the following commands, on separate lines, replacing folder 1 & 2 for your own folder and path names.
xcopy C:folder1 C:folder2 /D /E
xcopy C:folder2 C:folder1 /D /E
xcopy C:folder2 C:folder1 /D /E
Save your file as sync.bat. You will need ensure you don’t save it as a txt file by selecting all files in the filetype dropdown.
You can test this out now, by double clicking on the batch file. You should then be able to prove it has worked by both folders containing the same files.
Test it some more by putting a text file in folder and then syncing. Check that the file is copied across to both. Try updating both text files and then syncing your folders. The most recently updated text file should be able to be found on both, with the older of the two being lost forever.
Scheduling your batch file:
It is nice to think that we will backup our data regularly on our own accord, but if you are like the other 4 billion or so computer users in this world, you would find it best to schedule it so you don’t need to check up on it again.
This is slightly different between XP and Vista, but the theory is the same so I will run through how to do this in XP. Vista calls their scheduler “Task Scheduler”, where as XP calls its scheduler “Scheduled Tasks”. Both can be found by clicking “Start” -> “Accessories” -> “System Tools”.
Click “Add Scheduled Task”
Click “Next”
Click “Browse” and navigate to your batch file
Select how frequently you would like it to happen. If your computer is on all the time, 3am is ideal. If you don’t have your computer on much, make it happen as your computer starts. This is completely up to you.
Follow the date prompts and that is it.
Click “Next”
Click “Browse” and navigate to your batch file
Select how frequently you would like it to happen. If your computer is on all the time, 3am is ideal. If you don’t have your computer on much, make it happen as your computer starts. This is completely up to you.
Follow the date prompts and that is it.
You are still able to launch the file manually if you require it to happen instantly, but otherwise, your folders will always be synced at the scheduled time.
Please check out part two of this article when it is available (Monday), which covers SyncToy so you can compare the two methods and figure out which you would prefer to use. I hadn’t played with xcopy much before writing this article, and I am thinking I may well end up using it over SyncToy. I feel like there is more control this way.
I hope you have enjoyed this article and found it useful. Please stick around and check out some other articles at Inspect My Gadget.
Related Posts
Leave a Comment
How to Sync Two Folders with Command Line?
Sometimes, you may need to sync two folders located in different computers or locations, to make the two folders keep the same content. Here we will show you different ways to perform Windows sync two folders with command line tool.
Robocopy Command Line
Robocopy as an one-way sync solution, provides you different parameters to sync two folders in Windows 10/8/7, let’s see how it works.
If you prefer to use Robocopy to sync two folders, please know the syntax of Robocopy:
robocopy [[ ..]] []
1. specifies the path to the source directory.
2. specifies the path to the destination directory.
3. [[ ..]] specifies the file or files to be copied.
4. [] adds some copy options, such as:
- /s: Copies subdirectories. Note that this option excludes empty directories.
- /e: Copies subdirectories. Note that this option includes empty directories.
- /lev: Copies only the top N levels of the source directory tree.
- /z: Copies files in restartable mode.
- /b: Copies files in Backup mode.
- /zb: Uses restartable mode. If access is denied, this option uses Backup mode.
- /efsraw: Copies all encrypted files in EFS RAW mode.
- /copyall: Copies all file information, including D (Data), A (Attributes), T (Time stamps), S (Security: NTFS access control list (ACL)), O (Owner information), U (Auditing information)
To know more parameters you could use, please input robocopy /? to get more details.
Robocopy Sync Two Folders (One-Way)
To sync two shared folders with Windows command line tool - Robocopy, please follow the steps listed below:
1. Input the cmd in Windows 10 search box, and right click the Command Line, choose Run as administrator.
2. For example, sync tmp folder(and its subfolders) located in 192.168.0.250PublicShare to 192.168.0.58WorkD, please input the following command line:
robocopy 192.168.0.250PublicSharetemp 192.168.0.58WorkD /e /copy:DAT /mt /z
- /copy:DAT: means you will copy the source folder to destination folder with D (Data), A (Attributes), T (Time stamps), and you could modify these copied files. If you don’t want to modify these folders and files, you could replace /copy:DAT to /copyall or /copy:DATSOU.
- /mt: Creates multi-threaded copies with 8 threads.
All the files will be synced from 192.168.0.250PublicSharetemp to 192.168.0.58WorkD.
Robocopy Incremental Sync
Windows sync two folders with command line tool - Robocopy is quite simple as long as you specify the right parameters. Besides, Robocopy could create incremental sync task for you.
If there is a change on the source folder, you could use /xo or /xc to let Robocopy sync changes only to the destination folder.
Such as, sync changed part from source 192.168.0.250PublicSharetemp to 192.168.0.58WorkD in restart mode and Creates multi-threaded copies with 8 threads, input the following command line:
robocopy 192.168.0.250PublicSharetemp 192.168.0.58WorkD /e /copy:DAT /mt /z /xc /xn /xo
- /xo: Excludes older files (excludes existing files older than the copy in the source directory).
- /xc: Excludes changed files (excludes existing files with the same timestamp, but different file sizes).
- /xn: Excludes newer files (excludes existing files newer than the copy in the source directory).
- With /xc, /xn, /xo specified, Robocopy will exclude files existing in the destination directory.
Robocopy Real Time Sync Two Folders
As a matter of fact, Robocopy offers you /mot: to monitor changes in M minutes (only accept minutes as argument), you can’t monitor changes less than one minutes.
For example, monitor every one minutes based on the above command, type the command:
robocopy 192.168.0.250PublicSharetemp 192.168.0.58WorkD /e /copy:DAT /mt /z /xc /xn /xo /mot:1
- /mot:: Monitors the changes in source every N minutes and sync it to destination.
Or you could use batch files to add sync task to Windows Task Scheduler to continuously copy all files changes.
Besides, if you want to perform mirror sync with Robocopy, you could specify the /purge parameter to delete destination files and directories that no longer exist in the source.
Windows Sync Two Folders via Command Line (Robocopy) Limitation
However, there are some restrictions using Robocopy sync two folders:
- It’s quite complicated to understand all the parameters if you are not familiar with the command line tool - Robocopy.
- You will lose important files and folders once specified wrong parameters.
- Robocopy sync folders both ways (two way sync) is not supported.
Easier Way to Sync Two Folders in Windows 10/8/7
If you want to sync files more flexible and easily, it’s highly recommended to try the best file synchronization software - AOMEI Backupper Professional, which is designed for Windows XP, Vista, 7, 8, 8.1 and 10, including 32-bit and 64-bit. You could sync two folders easier on the intuitive GUI.
With the help of AOMEI Backupper Professional, you could:
- Sync folders to multiple destinations: you could sync files and folders to local disk, external hard drive (HDD or SSD), CD/DVD, USB flash drive, network share or NAS, even to the cloud(Google Drive, Dropbox, OneDrive, Box, etc.).
- Flexible sync features: It offers you basic sync, mirror sync, real time sync, and the two way sync.
- User-friendly interface: It's easy to operate even you're the novice.
Please download the file synchronization software for Windows - AOMEI Backupper Professional 30 day free trial to have a try:
To show you how it works to sync two folders in real time in Windows 10, please refer to the following instructions:
Step 1. launch AOMEI Backupper Professional on your Windows 10 computer, select Sync tab and then Real-Time Sync.
Step 2. Press + Add Folder button >Share/NAS >Add Network Location > input the Display Name and Network Path to add the network share, and choose the folder you want to sync.
Step 3. Click the triangle icon and tap Select a network location, and click Add Network Location > input the Display Name and Network Path to add another destination network share, choose the folder as target.
Step 4. Hit Start Sync >> to sync two folders in real time in Windows 10.
Robocopy Continuous Sync
★Tip: the Options allows you comment the real time folder sync task, and verify the integrity of the files in the destination location during synchronization, etc.
![Sync Sync](/uploads/1/3/7/5/137554564/934978607.jpg)
After the first full folder sync, then any changes made on the source folder will be synced to the destination immediately.
Besides, you could set up a mirror sync with schedule, such as daily, weekly, monthly, event triggers, USB plug in. You will get the email or SMS notification after setting up email notification.
The Epilogue
Robocopy Folder To Folder
Compared with Windows sync two folders via command line tool - Robocopy, the best file sync software - AOMEI Backupper Professional provides you flexible ways to sync two folders in Windows 10, 8, 7.
Robocopy Mirror Folder One Way
If you are running Windows Server 2003, 2008, 2012, 2016, 2019 (including R2) and SBS 2003, 2008, 2011, please try AOMEI Backupper Server to enjoy.