我有一个要求,将必须找到最新的修改文件列表,以及日期和时间。我们主要有2文件,boot.properties和ldap相关文件作为beadmin密码更改活动的一部分。
find /target_directory -type f -name "*boot.properties" -exec ls -ltr {} \;是只给boot.properties,但我需要找到其他文件,是在不同的位置。
发布于 2020-02-17 17:16:21
如果您有不同的位置和文件名,请尝试这样的方法。
find /root_directory \
\( \( \
-path "/target_directory1/*" -type f -name "*boot.properties" \) -o \( \
-path "/target_directory2/*" -type f -name "*boot2.properties" \
\) \) -exec ls -ltr {} \;此外,您还可以通过修改的日期找到其他选项。查看本文https://www.cyberciti.biz/faq/linux-unix-osxfind-files-by-date/
发布于 2020-02-17 17:27:59
find支持多路径参数,因此您可以执行以下操作
find /target_dir /other -type f \( -name "*boot.properties" -o -name "other*" \) -exec ls -ltr {} +https://stackoverflow.com/questions/60267013
复制相似问题