find命令通过排序只保留最新的文件目录 find /usr/local/canal/logs/example -type d -name "*-*" | sort -nr | awk '{if (NR>=2){print $1}}' | xargs rm -rf