-
Notifications
You must be signed in to change notification settings - Fork 3
Bash: Copy files in Linux faster and safer than cp
Michael Watts edited this page Mar 28, 2022
·
1 revision
rsync --info=progress2 -auvz ~/Music/ /data/music/
giving a result like this:
Jake Bugg - Jake Bugg Album 2012/
Jake Bugg - Jake Bugg Album 2012/01 - Lighting Bolt.mp3
1,913,897,967 15% 22.79MB/s 0:01:20 (xfr#277, ir-chk=1019/1825)
Jake Bugg - Jake Bugg Album 2012/05 - Simple As This.mp3
1,936,698,070 15% 22.80MB/s 0:01:21 (xfr#281, ir-chk=1015/1825)
You can also use it with -n option to perform a dry run (this is more used than the skype test call), that checks and lists the differences between the two given directories. You can use it too with "-e ssh" user@host:dst/ or without --info option in older versions of rsync. It is slower for copying but it does a lot of useful things such syncing, checkings md5sums.... You will remember rsync if something goes bad.
Another fantastic command for copy is gcp. Besides of progress estimation, gcp does not copy when the file exists, skips to the next file if occurs an error, and all the fails are written to a journal file.
$ gcp -rv ~/Music/* /data/music/
Copying 13.53 GiB 2% |# | 165.50 MB/s ETA: 0:01:25