I was wondering what is the advantage of making all the files and directories into an archive file for transfer, such as by cpio, instead of transferring them directly, such as by cp, scp?
archive files and directories before transfer
linux;files
There are a few reasons you might want to tar up a bunch of files before transfer:Compression: You will get better compression by compressing one large file rather than many small files.  At least scp can compress on the fly, but is on a file by file basis.Connections: At least with scp, it makes a new connection for each file it transfers.  This can greatly slow down the throughput if you are transferring many small files.Restart: If your transfer protocol allows restarting a transfer in the middle, it might be easier than figuring out which file was in progress when the transfer was interrupted.Permissions: Most archiving programs let you retain the ownership and permissions of files, which may not be supported in your transfer program.File location: If the destination location is at the end of a long path, or hasn't been decided, it might be useful to transfer an archive to the destination and decide latter where the files should go.Integrity: Its easier to compute and check the checksum for a single archive file than for each file individually.