Another way to mirror two folders under Linux & Windows

Blog
Linux
Windows

There are many tools and utilities for syncing files and folders, and yet there are even more. In this tutorial i'll introduce you to several reliable free command line and visual utilities for mirroring a folder into another folder.

This tutorial was originally part of another article but i came up with a much better solution for that one and there was no longer any need for this part so i decided to publish it as separate tutorial. It's not unique but all the same some people may find it useful.

Linux / Command Line

Linux offers many applications for this purpose but to simplify things i'll start with command line :

rsync --delete --checksum --exclude 'nothisfolder' --exclude 'nothisone' --stats --progress /home/user/folder/ /home/user/newfolder/

If you don't have rsync installed , it's as easy as issuing the following command :

apt-get install rsync

For RedHad based distributions use :

yum install rsync

Notice : If there are more folders you want to exclude , have a look at this page for more information about --exclude option.

Windows / Command Line

In Windows you can run rsync under Linux simulated environment via cygwin or use a native executable file which comes with DeltaCopy (rsync GUI for windows). executable file is called "rsync.exe".

There is also an alternative command line utility in Windows called RoboCopy which is available on recent Windows versions and also as part of   Windows Server 2003 Resource Kit Tools.  Although it's not as complete and as flexible as rsync but it's at least better than previous utilities like xcopy.

Here is the command :

ROBOCOPY C:\the_new_folder C:\folder /PURGE /XD .svn  /XD CVS
robocopy "C:\Users\Sina\Desktop\folder" "C:\Users\Sina\Desktop\newfolder" /E /CREATE /PURGE /V /NP /XD nothisfolder */notthisfolder /R:10 /W:30 

For more information about robocopy switches and options visit here

Linux / Visual

There are many tools for visually comparing and syncing folders , personally i use "grsync" (which is a GUI for popular rsync command) for syncing and Kompare (Qt based) for comparing files. you can install grsync by running the following command

apt-get install grsync

For RedHad based distributions :

yum install grsync

Steps :

Step 1: Running grsync
Step 2: Setting source and destination folders and also selecting require options.
Check "Delete on destination" under "Basic Options" tab for deleting files/folders on destination.
Step 3 : Selecting require options
Select "Advanced options" and Check "Always checksum" for more accurate file synchronization
Step 4 : Selecting require options
Enter "--exclude '.svn'" in "Additional options" text box for excluding .svn folders from synchronization , otherwise it may delete this important folders.
More information about --exclue option

Step 5 : Entering a name for session
If you want to repeat this sync again, you can enter a name for it.

Step 6 : Executing
Click on "Execute" button and wait until the synchronization finishes.

Windows / Visual

As described before Microsoft includes a new file system utility software called robocopy in its recent Windows versions which is very similar to rsync. Using it, is quite difficult comparing to rsync but fortunately there is also 2 GUIs available for this command. The first one is called RoboCopy GUI and the other one is RichCopy.

None of this GUIs are complete, each one has some disadvantages. I can barely call RoboCopyGUI a GUI! it's only a set of check boxes and edit boxes with no simplicity. And RichCopy also does not support all the important RoboCopy features , including the ones require for what we're about to do , There will be no choice but to use RoboCopy GUI!!

Resources

Your rating: None Average: 1.4 (139 votes)

Comments

Visitor's picture

You seem to be very cool and

You seem to be very cool and your theme referring to this good post supposes to be master’s. Should you continue your story? We will purchase some legal dissertation and just thesis writing from you.