How Do I Remove Older Than One Day in Linux?
Contents How Do I Delete 7 Day Old Logs in Linux? Explanation: Find: the Unix Command for Finding Files/Directories/Links and Etc. /Path/to/: the Directory to...
Contents
How do I delete 7 day old logs in Linux?
Explanation:
- find : the unix command for finding files/directories/links and etc.
- /path/to/ : the directory to start your search in.
- -type f : only find files.
- -name ‘*. …
- -mtime +7 : only consider the ones with modification time older than 7 days.
- -execdir …
Must Read
How do I delete files older than 180 days Linux?
As before, the -mtime parameter is used to find files older than X. In this case, it’s older than 180 days. You can either use the -delete parameter to immediately let find delete the files, or you can let any arbitrary command be executed ( -exec ) on the found files.