命令 'stat' 的文件名太长错误
File name too long error with command 'stat'
我使用命令
搜索主目录中的 python 本书后检索了一个书单
find ~ -type f -iregex '.*python.*\.pdf'
书单
...
.../Computing/Python/Beginning_Python.pdf
.../Python/Core.Python.Applications.Programming.3rd.Edition.pdf
.../Python/Packt.Mastering.Python.2016.4.pdf
...
我打算用命令 xargs
和 stat
检查他们的状态
find ~ -type f -iregex '.*python.*\.pdf' | xargs -0 stat -x
得到错误
: stat: File name too long
如何克服这样的问题?
如果您将 -0
与 xargs
一起使用,您还应该将 -print0
与 find
一起使用。
我使用命令
搜索主目录中的 python 本书后检索了一个书单 find ~ -type f -iregex '.*python.*\.pdf'
书单
...
.../Computing/Python/Beginning_Python.pdf
.../Python/Core.Python.Applications.Programming.3rd.Edition.pdf
.../Python/Packt.Mastering.Python.2016.4.pdf
...
我打算用命令 xargs
和 stat
find ~ -type f -iregex '.*python.*\.pdf' | xargs -0 stat -x
得到错误
: stat: File name too long
如何克服这样的问题?
如果您将 -0
与 xargs
一起使用,您还应该将 -print0
与 find
一起使用。