Linux下如果想要批量删除制定时间的文件,可以使用find命令:

find /home -maxdepth 1 -type f -newermt "Nov 22" -print

find命令查找/home 目录下的十一月22日创建的类型是文件的该层文件并打印输出。

-maxdepth 用于设置查找的最大层数,设置为1是不让递归查找。

-type 制定查找的类型。

-newermt 制定查找的时间。

如果我们使用-delete参数则会删除制定时间的文件:

find /home -maxdepth 1 -type f -newermt "Nov 22" -delete

还有其他一些参数,可以参见find命令的帮助信息。

点赞(118)

评论列表共有 0 条评论

立即
投稿
返回
顶部