Quantcast
Channel: command
Viewing all articles
Browse latest Browse all 11

Linux backups: Using find, xargs, and tar to create a huge archive

$
0
0
Linux backups: Using find, xargs, and tar to create a huge archivealvinOctober 31, 2019 - 4:38pm

I did something wrong in a previous blog entry that led me to use the pax command to create a large backup/archive. There’s nothing wrong with using pax— other than the fact that it’s not available for Cygwin— and I really needed to created a huge archive.

What wasn’t working

In my earlier blog post I stated that something like this did not work for me when trying to create a large backup using find, xargs, and tar:

find . -type f -name "*.java" | xargs tar cvf myfile.tar

What was happening was that as xargs was managing the input to the tar command, tar kept re-writing the archive. That is, each time xargs passed a new block of input files to tar, tar perceived it as a new command, and went on to re-create the file named myfile.tar. So, instead of the huge myfile.tar that I expected, I ended up with only a few files in the archive.


Viewing all articles
Browse latest Browse all 11

Trending Articles