我有这一行,但我需要它仅在 /home/user
位置下的 XML 文件夹和子文件夹上运行:
find /home/user "*.xml" -type f -name +4 -exec rm -f {}\;
最佳答案
先找到“XML”文件夹,然后删除xml文件。
find /home/user -type d -name "XML" |while read folder
do
find ${folder} -type f -name "*.xml" -mtime +28 -exec rm -f {} \;
done
关于linux - 使用 bash 脚本从具有相同文件夹名称 XML 的不同位置删除超过 4 周的 xml 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21377392/