Linux (zip): 如何找到所有不可读的文件?
Linux (zip): how to find all files that are not readable?
我刚刚尝试 zip 文件夹,它的内容是通过这个命令:
zip -r ./mytarget.zip ./mysource
最后我得到了警告:
zip warning: Not all files were readable
files/entries read: 141595 (4.2G bytes) skipped: 57 (1.8M bytes)
我想知道跳过了哪些文件。
我怎样才能找到所有不可读的文件?我对该服务器没有sudo
权限。
提前致谢!
你可以使用
find . ! -readable
以递归方式扫描不可读的文件或目录。此命令考虑了权限,但也考虑了断开的链接。
我和你的经历一样,find . ! -readable
没有帮助。
我通过将 zip 命令的所有输出记录到一个文件中解决了这个问题:
zip -r my-archive.zip /path/to/dir/ &>> zip-log
然后在其中搜索 warning
词,它不仅作为摘要出现在命令输出的末尾,而且还出现在每个引起问题的文件之后(我的 2案例):
adding: home/myuser/.cagefs/tmp/mysql.sock
zip warning: could not open for reading: home/myuser/.cagefs/tmp/mysql.sock
adding: home/myuser/.cagefs/tmp/lshttpd/ (stored 0%)
adding: home/myuser/.cagefs/tmp/.s.PGSQL.5432
zip warning: could not open for reading: home/myuser/.cagefs/tmp/.s.PGSQL.5432
我刚刚尝试 zip 文件夹,它的内容是通过这个命令:
zip -r ./mytarget.zip ./mysource
最后我得到了警告:
zip warning: Not all files were readable
files/entries read: 141595 (4.2G bytes) skipped: 57 (1.8M bytes)
我想知道跳过了哪些文件。
我怎样才能找到所有不可读的文件?我对该服务器没有sudo
权限。
提前致谢!
你可以使用
find . ! -readable
以递归方式扫描不可读的文件或目录。此命令考虑了权限,但也考虑了断开的链接。
我和你的经历一样,find . ! -readable
没有帮助。
我通过将 zip 命令的所有输出记录到一个文件中解决了这个问题:
zip -r my-archive.zip /path/to/dir/ &>> zip-log
然后在其中搜索 warning
词,它不仅作为摘要出现在命令输出的末尾,而且还出现在每个引起问题的文件之后(我的 2案例):
adding: home/myuser/.cagefs/tmp/mysql.sock
zip warning: could not open for reading: home/myuser/.cagefs/tmp/mysql.sock
adding: home/myuser/.cagefs/tmp/lshttpd/ (stored 0%)
adding: home/myuser/.cagefs/tmp/.s.PGSQL.5432
zip warning: could not open for reading: home/myuser/.cagefs/tmp/.s.PGSQL.5432