Microsoft Robocopy imitation (with recursion, pruning, and compression)

rsync -ahhmz --progress --stats [[user@]host:]/source/path/ [[user@]host:]/destination/path/
Functionally the same as the Microsoft Robocopy (https://en.wikipedia.org/wiki/Robocopy) command below but with the benefits of compression and optionally specifying a user. robocopy /e [//host]/source/path [//host]/destination/path Options: -a: archive mode - rescursive, copy symlinks as symlinks, preserve permissions, preserve modification times, preserve group, preserve owner, preserve device files and special files -hh: Numbers in human-readable K=1024 format. Single "h" will produce human-readable K=1000 format -m: don't copy empty directories -z: use compression (if both source and destination are local it's faster to omit this) --progress: Shows progress during the transfer and implies --verbose (verbose output) --stats: Summary after the transfer stops
Sample Output
$ rsync -amzhh --progress --stats /cygdrive/c/Users/joe/ /cygdrive/e/Users/joe
building file list ...
1650 files to consider
./
AppData/
AppData/Roaming/

...

Videos/
Videos/DeionSanders9911.jpg
      40.72K 100%   63.63kB/s    0:00:00 (xfer#1547, to-check=0/1650)

Number of files: 1650
Number of files transferred: 1547
Total file size: 1.32G bytes
Total transferred file size: 1.32G bytes
Literal data: 1.32G bytes
Matched data: 0 bytes
File list size: 54.76K
File list generation time: 0.203 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 1.16G
Total bytes received: 28.95K

sent 1.16G bytes  received 28.95K bytes  1.90M bytes/sec
total size is 1.32G  speedup is 1.14

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: