-newerXY引用比较当前文件的时间戳和引用。引用参数通常是文件的名称(其中一个时间戳用于比较),但也可能...
find [路径] -type f -atime [+-][天数] 其中,-atime表示按访问日期查找文件。 如果要按照创建日期查找文件,原生的Linux命令无法直接实现。但可以通过安装使用额外的工具来实现,例如通过安装exiftool工具,可以使用以下命令来查找文件的创建日期: exiftool -r -s -CreateDate [路径] 以上是按照日期查找文件的基本...
4. If this needs to be done on a remote server through cron job and log the filenames of deleted files, use the following command # ssh user@remote_ip "find /path_to_directory -name 'filenamepattern*' -mtime +7 -type f -exec rm -fv {} \; >> /tmp/backup_deletion`date...
echo "" >> \$MESSAGE SUBJECT="WARNING: Apache log folders are deleted older than 15 days \$(date)" mail -s "\$SUBJECT" "\$TO" < \$MESSAGE rm \$MESSAGE /tmp/file.out fi 给delete-old-files.sh设置可执行权限。 # chmod +x /opt/script/delete-old-files.sh 最后添加一个 自动化此任...
The second argument, -mtime, is used to specify the number of days old that the file is. If you enter +5, it will find files older than 5 days. The third argument, -exec, allows you to pass in a command such as rm. The {} \; at the end is required to end the command. ...
find/home/user/<directory>-mtime+3-execrm{}\; Let’s break down the previous command to get the complete information about deleting the files older than a specific date. The /home/user/<directory> represents the targeted directory in which you want to delete the files. ...
find是真正的在系统的树形结构中进行文件查找的! Linux下find命令在目录结构中搜索文件,并执行指定的操作。 Linux下find命令提供了相当多的查找条件,功能很强大。由于find具有强大的功能,所以它的选项也很多,其中大部分选项都值得我们花时间来了解一下。 即使系统中含有网络文件系统(NFS),find命令在该文件系统中同样有...
This is a very simple tutorial on how to find, move and delete files older than X days. I needed this for a project where I collected some images and needed to archive and delete them after a while. With this, you will be able with the Linux find command to find your JPG files ...
Linux中的各类时间 与 find命令的常用参数 之前研究wal日志清理的副产物,wal日志名被修改后文件的哪个时间会变?应该如何删除?由此整理一下Linux中atime、mtime、ctime的区别,以及find的常见用法。 一、 Linux中的各类时间 1. 各类时间的定义 Linux中有三种用于文件时间戳的概念:...
find /path -name "filename":按名称查找文件find /path -type f -mtime -7:查找7天内修改过的文件 grep- 文本搜索 grep "pattern" filename:在文件中搜索指定模式grep -r "pattern" /path:递归搜索目录中的文件 diff- 比较文件差异 diff file1 file2:比较两个文件的差异 系统信息与管理 uname- 显示...