bash: /bin/tar: Argument list too long when compressing many files with tar

扶醉桌前 提交于 2019-12-03 08:51:20

问题


I am trying compress files from an archive with the command

tar -czvf compress_file.tar.gz $(cat file_list.txt)

And I have an error

-bash: /bin/tar: Argument list too long

The files numbers is too long, how can I resolve this?


回答1:


Use the "-T" option to pass a file to tar that contains the filenames to tar up.

tar -cv -T file_list.txt -f tarball.tar



回答2:


and how to make list of files to tar up: first ls > temp ## create the list of files to tar up then tar cvzf dicionario_ultra.tgz -X FILE -T temp and finally rm temp



来源:https://stackoverflow.com/questions/23817787/bash-bin-tar-argument-list-too-long-when-compressing-many-files-with-tar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!