Reply to comment
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
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
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
|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!!
- Use a diff utility (diff in Linux , WinMerge in Windows or anything other tools) to create a full file/folder patch between these two folders (you should ignore custom folders like site's folder) (Note than moved , renamed files won't be detected , it's possible to detect those changes to but i think it does not worth the time)
- DiffUtils for Windows
- Windows users could use WinMerge but unfortunately it does not support filtering folders/files by full path, there is however plan for future releases
- Folder Compare - compare folders and files with Guiffy.
diff --recursive --exclude=nothisfolder --exclude=nothisone C:\Users\Sina\test C:\Users\Sina\testnewComparing and Merging Files
- Linux Commando: Compare Directories using Diff in Linux
- diff - Linux Command - Unix Command