找不到列表中的文件

我有一个file.lst文件的列表。 现在,我想查找目录dir所有文件,除了file.lst文件中的文件之外,它们都是7天以前的文件。 如何修改find​​命令或从结果中删除file.lst中的所有条目?

例:

file.lst

 a b c 

执行:

 find -mtime +7 -print > found.lst 

found.lst

 a d e 

所以我期望的是:

 d e 

Solutions Collecting From Web of "找不到列表中的文件"

通过grep -Fxvf管道find命令:

 find -mtime +7 -print | grep -Fxvf file.lst 

标志是什么意思:

 -F, --fixed-strings Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched. -x, --line-regexp Select only those matches that exactly match the whole line. -v, --invert-match Invert the sense of matching, to select non-matching lines. -f FILE, --file=FILE Obtain patterns from FILE, one per line. The empty file contains zero patterns, and therefore matches nothing. 

使用-v-f开关将find命令传递给grep

 find -mtime +7 -print | grep -vf file.lst > found.lst 

grep选项:

 -v : invert the match -f file: - obtains patterns from FILE, one per line 

例:

 $ ls abcd file.lst $ cat file.lst a$ b$ c$ $ find . | grep -vf file.lst . ./file.lst ./d