Added ContentSync command line arguments


I’ve added various command line arguments to the tool I blogged about the last time.

The new release is here:

https://github.com/KirillOsenkov/ContentSync/releases/tag/v1.1

Now you can customize what operations to perform:

image

-c       Copy files from source that don’t exist in destination (left-only).

-u       Update files that have changed between source and destination. This only overwrites the destination file if the contents are different.

-d       Delete right-only files (that are in destination but not in source).

-ds      Delete same files (that exist in source and destination and are same).

-dc      Delete changed files from destination (can’t be used with -u).

-whatif  Print what would have been done (without changing anything).

-h         Help (duh!)

Examples:

Update only the files that exist both in source and destination:

ContentSync.exe C:\Source D:\Destination –u

This scenario is useful when you’ve selected a subset from a folder and copied it to a separate folder, but now realized that you want to copy the same subset to the new folder again from updated source.

This command will copy new files and update changed ones, but won’t delete any extra remaining files from destination:

ContentSync.exe C:\Source D:\Destination –cu

Additionally you can use –whatif for speculative mode, when it prints what it would have done without actually changing anything on disk:

ContentSync.exe C:\Source D:\Destination –d –whatif

This prints out all the files that are in destination but not in source (without actually deleting them from the destination). Just passing –whatif results in diffing the contents of both folders (it doesn’t actually show detailed file diffs, just shows which files are identical and which are different).

I wanted to just take robocopy options, but they didn’t map exactly to the concepts I wanted to represent. So I opted for a new argument syntax.

Finally it prints out a summary at the end:

image


Comments (0)

Skip to main content