• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Get Rid of Old IFS Files, Take Two

    December 6, 2002 Timothy Prickett Morgan

    Hey, Ted:

    I have worked with Unix for 18 years. Here is a Qshell command that will remove any file that is more than seven-days old. (It also checks subdirectories).

    Here is the command:

    find * -type f -mtime +7 -exec rm {} ;
    

    — Mike

    I am grateful to Mike for providing that tip.

    Now, let’s break that command down so we can understand it.

    The find command locates files that match certain criteria. In this case, find looks for files that have not been modified in the last seven days.

    The find command may be followed by options. In this example, no options are specified.

    After the options comes the name of the file(s) to be searched. The asterisk (*) is a wildcard symbol meaning all files in the current directory and any subdirectories under the current directory are considered for selection.

    The -type, -mtime, and -exec tokens are called primaries. The values that follow each of them are called operands. Together they form an expression that tells find which files to select.

    A -type of f means that find is to search for regular files. A -mtime of +7 means that find is to look for files that have not been modified in seven days. The -exec primary indicates the action that find is to take when it selects a file. In this case, find is to run the rm (remove file) utility. Find replaces the empty braces with the name of the selected file.

    I am very cautious when it comes to deleting things, so if you want to play with this command, I suggest you replace rm with echo, as in this example:

    find * -type f -mtime +7 -exec echo {} ;
    

    Find will list the names of the files instead of removing them. Do not replace echo with rm until you are certain that find locates the files properly.

    To learn more about the find utility, visit the iSeries Information Center’s Find files Web page at http://publib.boulder.ibm.com/iseries/v5r2/ic2924/info/rzahz/find.htm . For another example, see “Grepping it Up“, in the January 11, 2002, issue of Midrange Guru.

    — Ted

    Sponsored By
    ADVANCED SYSTEMS CONCEPTS

    Business Analytics
    – Practical –
    – Cost Effective –
    – Easy to Deploy –

    SEQUEL FYI

    User Quote:
    “I love SEQUEL FYI because it lets me look at the data any way I need to see it, instantly. This is the easiest tool to manage complex product relationships that I have ever seen.”

    SEQUEL FYI offers outstanding OLAP business intelligence functionality for a fraction of the cost of comparable solutions.

    Read More > View Streaming Video

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags: Tags: mgo_rc, Volume 2, Number 91 -- December 6, 2002

    Sponsored by
    Maxava

    Maxava Partner Webinar: What’s New with IBM PowerVS

    Tonny Bastiaans, IBM’s Worldwide Offering Manager for PowerVS, will share insights into the evolving landscape of IBM’s cloud-based Power platform, while Maxava’s Ash Giddings will discuss how businesses can leverage these advancements for improved flexibility, scalability, and resilience.

    Register Now

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    LIKE is Like, Confusing, Man! SBMJOB’s RQSDTA Parameter

    Leave a Reply Cancel reply

MGO Volume: 2 Issue: 91

This Issue Sponsored By

    Table of Contents

    • Reader Feedback and Insights: One-Row Table Still Needed
    • Get Rid of Old IFS Files, Take Two
    • Performance of the SQL LIKE Predicate

    Content archive

    • The Four Hundred
    • Four Hundred Stuff
    • Four Hundred Guru

    Recent Posts

    • What You Will Find In IBM i 7.6 TR1 and IBM i 7.5 TR7
    • Three Things For IBM i Shops To Consider About DevSecOps
    • Big Blue Converges IBM i RPG And System Z COBOL Code Assistants Into “Project Bob”
    • As I See It: Retirement Challenges
    • IBM i PTF Guide, Volume 27, Number 41
    • Stacking Up Power11 Entry Server Performance To Older Iron
    • Big Blue Boosts IBM i Support In Instana, Adds Tracing
    • It Is Time To Tell Us What You Are Thinking And Doing
    • IBM i PTF Guide, Volume 27, Number 40
    • The GenAI Boom Is Only Slightly Louder Than The Dot Com Boom

    Subscribe

    To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

    Pages

    • About Us
    • Contact
    • Contributors
    • Four Hundred Monitor
    • IBM i PTF Guide
    • Media Kit
    • Subscribe

    Search

    Copyright © 2025 IT Jungle