find files more than 30 minutes old

Posted on 2006-03-23
Last Modified: 2013-12-27

How can I use the find command to find files that are more than 30 minutes old?.
Question by:daveyu
    LVL 3

    Expert Comment

    the find mtime, ctime and atime options only take integers so you can only get a day granularity.  Try a script using perl stat function something like

    ($filename) = @ARGV;
    die "I need a file name.\n" unless $filename;
       ($atime,$mtime,$ctime) = stat($filename);
       print "atime = $atime\n";
       print "mtime = $mtime\n";
       print "ctime = $ctime\n";
    LVL 38

    Accepted Solution

    Download the GUN find (findutils), for you version of OS from:

    then you can use:

    /usr/local/bin/find /mydir -type f -cmin +30 -print

    With the native Solaris "find", the best you can do is "touch & find"

    you need to do something like:

    create stamp file , then
    touch -t [YY]MMDDhhmm stampfile

    write the current date ,
    and time older than the current time by 30 min.

    touch -t 200307120000 stampfile

    find /yourdir -type f ! -newer stampfile -print

    also see http:Q_20670315.html

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
    A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now