Thursday, July 7, 2011

dirsync - directory content synchronization tool

I released an older project of mine - dirsync. It is a command-line tool to synchronize content (files and folders) of two directories. Why another tool when rsync and his relatives have been already there? Dirsync makes sure that the free space on the target drive does not get exhausted if it is almost full and many files were changed on the source drive. It performs the deletion operations at first to make place for the new files to be copied there.

For example, how to synchronize photos from the working drive to a backup one recursively including subfolders:

  dirsync D:\Photos E:\Photos

Firstly, files are deleted from the target directory that cannot be found in the source one. Then existing files get updated if their source counterparts have newer last modification time. Finally, new files are copied to the target drive.

What to do if there are two root directories on a single drive to synchronize and you still make sure all files to be deleted are processed first? Specify the operations to perform selectively:

  dirsync -o:delete D:\Movies E:\Movies
  dirsync -o:delete D:\Music E:\Music
  dirsync -o:update,create D:\Movies E:\Movies
  dirsync -o:update,create D:\Music E:\Music

Sources of the tool are maintained in the github repository.

No comments: