A handy Perl script tool to synchronize folders in SVN manner

Download the source code here

To execute the script, just invoke
perl syncfolder.pl SOURCE_FOLDER DEST_FOLDER

The tool synchronizes source folder to destination folder, in SVN manner. It does,

  • Add files/folders to destination folder which only exist in source folder.
  • Delete files/folders from destination folder which only exist in destination folder.
  • Override files in destination folder which exist in both source and destination folders and the file content is different. Unlike SVN, it doesn't merge files.

I wrote this tool to copy changed files from my development SVN repository to the publish repository which is hosted on Microsoft Codeplex. If you think it's useful, feel free to use or modify it on your purpose.

Discussion

Qi, 2013/11/22 04:00
Hi Malatesh,

Unfortunately the tool uses third party module File::DirCompare to execute the file comparing, so I doubt there is any workaround for your that problem up to now.
What's the error message did you get? "All up to date, nothing to do."?
Also, can you map the remote folder to local folder such as mapping "\\asd.zxc.com\sourcefolder" to "x:"?
Malatesh, 2013/11/22 05:00
Hi Qi,
Thanks a lot for your quick response.
Yes I got "All up to date, nothing to do."
after mapping the remote folder, it worked.
But, I wanted to use it as a common tool, irrespective of the remote folders.

Could it be possible to map remote folder to say "x:" in PL code. If possible, can you please reply me with code part.
Qi, 2013/11/22 07:51
http://www.windows-commandline.com/map-network-drive-command-line/
http://www.howtogeek.com/118452/how-to-map-network-drives-from-the-command-prompt-in-windows/

*net use z: \\remotepc\sharename*

You can either invoke the command from a batch file, or use "system" function in Perl to invoke it.
Malatesh, 2013/11/22 03:38
This tool won't consider paths like "\\asd.zxc.com\sourcefolder","\\asd.zxc.com\destfolder". Could you please help me to modify the code to consider above paths.
Enter your comment:
VNMXO