当前位置:网站首页>Argument list too long causes and Solutions

Argument list too long causes and Solutions

2022-07-19 15:32:00 Teacher Du said

Recently, when sorting out the drawing bed files , Because there are too many files , perform cp Command prompt Argument list too long. Simply put, the reasons and solutions !

Question why

stay Linux Next use cp/mv/rm When ordered , I often come across Argument list too long error .

This is mainly because cp/mv/rm The number of files is too large .

resolvent

Argument list too long The solution to this problem mainly uses two commands find and xargs.

Here to delete dusays Directory to com Suffix file as an example :

find dusays/ -name "*.com" | xargs -i rm -f {}find dusays/ -name "*.com" -exec rm -f {} \;

Copy dusays Directory to com Suffix file to 7bu Catalog :

find dusays/ -name  "*.com" | xargs -i cp {} 7bu/find dusays/ -name  "*.com" -exec cp {} 7bu/ \;

xargs A filter for passing parameters to other commands , It is also a tool for combining multiple commands . and -i The parameter will xargs The content of is assigned to {}.

原网站

版权声明
本文为[Teacher Du said]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/200/202207172346486176.html