Latest Posts

Latest Comments

Too many arguments with tar

By Geoff W. on Aug. 13, 2008.

Occasionally, when compressing directories with large numbers of files and/or directories contained within them, you will get an error stating: Too many arguments.

This is not an error from the application - rather it is an error from the shell tell you the ARG_MAX limit has been reached. Here is what you can do to avoid/get around that:

If you find that you can not compress a directory because it contains to many files, you can do one of two things:

Compress the container directory or:

Generate the file list
find -iname '*.ext' > file_list.txt

Run tar, passing it the file list
tar czvf archive.tar.gz --files-from file_list.txt

Shorthand of this would be:
find . -name '*.ext' -print | tar -cvzf archive.tar.gz --files-from -

Category: Linux

Sorry, comments for this entry are closed at this time.

© 2010 - LAMP Tips!
Designed by Shauryadeep Chaudhuri
Coded by XHTML Valid

Powered by WordPress