在下面的命令,我只想search只有非隐藏的目录我怎么能做到这一点使用下面的命令.Iwant忽略隐藏的目录,同时search日志文件
find /home/tom/project/ -name '.log.txt'
输出:
/home/tom/project/.log.txt /home/tom/project1/.log.txt find: Filesystem loop detected; ./.snapshot/hourly.0' has the same device number and inode as a directory which is 2 levels higher in the filesystem hierarchy. find: Filesystem loop detected; ./.snapshot/hourly.1' has the same device number and inode as a directory which is 2 levels higher in the filesystem hierarchy.
我想要消除所有的查找消息或不要隐藏在隐藏的目录中
ls /home/tom/project/ dir1 dir2 .backup .snapshot/ .ignore/
如果您只想忽略错误消息,则将stdoutredirect到文件或/ dev / null
find /home/tom/project/ -name '.log.txt' 2>/dev/null
如果您可能对其他错误信息感兴趣,但不是您在问题中提到的特定错误信息,则通过grep -v输出输出
find /home/tom/project/ -name '.log.txt' | grep -v 'Filesystem loop detected'
尝试
find . -name '.log.txt' ! -wholename ".*.*/.log.txt"
find名称为.log.txt的所有文件,但也要确保文件完整path在文件夹部分中不包含多个DOT。 第一个点是当前目录。
如果不是当前目录,则提供绝对path,请使用以下命令
find . -name '.log.txt' ! -wholename "*.*/.log.txt"