显示20分钟前的文件
find /home/prestat/bills/test -type f -mmin +20 -exec ls -l {} \;
删除20分钟前的文件
find /home/prestat/bills/test -type f -mmin +20 -exec rm {} \;
显示20天前的文件
find /home/prestat/bills/test -type f -mtime +20 -exec ls -l {} \;
删除20天前的文件
find /home/prestat/bills/test -type f -mtime +20 -exec rm {} \;
参考:https://www.cnblogs.com/morganchen/p/9437066.html
FastDFS删除指定文件脚本:
#!/bin/bash
#删除文件
#解释 找到/FastDFDS/FastDFS 目录下 30 天前修改的 名字任意 并删除
find /data2/fastdfs/fastdfs_storage_data/data -mtime +30 -name "*.*" -exec rm -rf {} \;
#删除文件夹
#find /data2/fastdfs/fastdfs_storage_data/data -mtime +1 -name "*" -type d -exec rm -rf {} \ ;
#chmod +x delete
参考:https://blog.csdn.net/weixin_42591789/article/details/86147518
本文介绍如何使用Linux下的find命令来查找和删除特定时间之前的文件,包括20分钟和20天前的文件,并提供了FastDFS环境下删除指定文件的脚本示例。

1736

被折叠的 条评论
为什么被折叠?



