Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前有以下代码来删除旧的日志文件
df -k /opt/logs/ ; find /opt/logs/*[.]log[.]* -mtime +5 -exec /bin/rm -fv {} \;
*.log.*但是 find 命令不是在子目录中搜索文件。我怎样才能让它在子目录中搜索
*.log.*
正确的查找语法应该是:
find /opt/logs -name "*.log.*" -mtime +5 -exec /bin/rm -fv '{}' \;