Tip: quickly verify a successful file transfer using tail and md5sum

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
HyperBear
Level 2
Level 2
Posts: 50
Joined: Thu May 04, 2023 3:39 am

Tip: quickly verify a successful file transfer using tail and md5sum

Post by HyperBear »

To verify that a file transfer was successful, running tail [path/]* |grep -v "==>" |md5sum for both the source and target path usually does suffice and can be 10 to 100 times faster than md5sum [path/]*. If the end of all files match, the file transfer was likely successful.

Code: Select all

tail [source/]* |grep -v "==>" |md5sum
tail [target/]* |grep -v "==>" |md5sum
Why not head? Because it will not detect incompletely transferred files. (Rare exceptions can exist, but they are not worth considering.)

tail prints the file names by default. This would cause a mismatch due to the different path names, except if you change the working directory to the target folder before running tail, so |grep -v "==>" filters out the path names.

Strangely, specifying tail with a low byte count, such as tail -c 512 * (to safeguard against the slight possibility of a file with very long lines), omits some files.
Post Reply

Return to “Software & Applications”