• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Delete the Files Which are Older Than n Days WITHOUT Using find Command

By admin

Question: How to delete the files which are older than n days WITHOUT use find command?

For some reason, the find command is not used to check which files are older than n days, as a substitute, ‘tmpwatch‘ can be used

The syntax is:

# tmpwatch [time in hours] [directory]

For example, to delete files under /root/testdir/ not accessed for last 45 days ( 24×45 = 1018 hours), run the following command:

# tmpwatch 1080 /root/testdir/

You could also specify the atime/mtime/ctime etc, to learn more, please check

$ man tmpwatch

Filed Under: CentOS/RHEL 6, CentOS/RHEL 7, Fedora, Linux

Some more articles you might also be interested in …

  1. How To Configure Separate Override.conf For Multiple MySQL Instances Using Systemd
  2. Apache HTTP server – most commonly used containers (special configuration directives)
  3. What is Soft Links and Hard Links in Linux File System
  4. CentOS / RHEL 5 : How to rebuild Initial Ramdisk Image
  5. 6 Useful journalctl Command Examples in CentOS / RHEL 7 (Cheat Sheet)
  6. How to add swap space in linux
  7. How to use “btrfs device” comamnd to add/delete device to/from btrfs filesystem
  8. How to find all the sparse files in Linux
  9. Supported and Recommended File Systems on Linux
  10. User Environment Variables With “su” and “sudo” in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • CentOS/RHEL 8: “ACPI MEMORY OR I/O RESET_REG” Server Hung after reboot
  • How to Create a Physical Standby Database by Using SQL and RMAN Commands
  • Basics of client connectivity in Oracle Data Guard configuration
  • ORA-354 ORA-353 and ORA-312: Possible corruption in Online Redo Log File Members in a Redo Log Group
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary