HACKER Q&A
📣 photoGrant

How are you transferring thousands of small files across networks?


Tangentially the answer is probably compression first, so I'm curious what the current settled opinion is on compression formats and workflows to get this done!


  👤 pwg Accepted Answer ✓
The canonical Unix method is to use tar in a pipeline to transfer them (assuming none exist at the destination):

tar -cf - /source | ssh destination "cd /destination ; tar -xf -"

However there are as many different ways of doing what you ask as there are opinions, so you may get far more "methods" than you ever knew existed.

If some number of them are already at the destination, then rsync will only send the ones that don't exist, and the ones that differ. What kind of performance will result for "thousands of small files" is a different matter (and note that in today's world, "thousands" is a relatively small number).


👤 darthShadow
My first goto for anything related to file transfer: https://rclone.org/

If you care about permissions, you can always run an rsync after rclone has finished the transfer because applying just the permissions is much faster than the actual single-threaded transfers of rsync.