Monday, October 6, 2008

Argument list too long

Have you ever seen this very annoying error message? I bet you have!

I had to move little over 36k files in one directory to another box. Scp and both let me know there's too many files for them to handle. So what to do?

Each shell session has a pre-configured amount of storage with a hard limit. To check it you can type getconf ARG_MAX which will type whatever the max arg is in your box.

You can work around this easily wit tar. Just pre-build list of filenames and then pass the list to tar:


find . -iname '*.gif' > list.txt
tar czvf files.tar.gz --files-from list.txt


Sit back and enjoy the ride while box archives your files!

No comments: