1847343 Members
2595 Online
110264 Solutions
New Discussion

Re: Tar question

 
Edgar_10
Frequent Advisor

Tar question

Hi,

I have a directory with approx.200000 files and would like to tar all to 1 file before copying to tape drive.My tar command fails stating that argument list too long.Any ideas on a work around?

Regards,
4 REPLIES 4
Stefan Farrelly
Honored Contributor

Re: Tar question

use xargs first, eg. in the dir with the 200k files;

ls | xargs tar cf
Im from Palmerston North, New Zealand, but somehow ended up in London...
twang
Honored Contributor

Re: Tar question

# tar cvf /tmp/dir.tar /dir
# tar cvf /dev/rmt/1m /tmp/dir.tar
Bruno Vidal
Respected Contributor

Re: Tar question

Hi
Your tar command is failing because you are using "tar cvf /tmp/myfile *" . Instead do:
"tar cvf /tmp/myfile . "
(in the case of * the shell replace * by all the files -> your command line is too long), replace it by ., and tar while be executed on the file ., -> ie all files of this directory.

Cheers.
T G Manikandan
Honored Contributor