• 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
    Rocket Software

    Two Steps Forward, No Steps Back

    For over 35 years, Rocket Software’s solutions have empowered businesses to modernize their infrastructure, unlock data value, and drive transformation – all while ensuring modernization without disruption.

    LEARN MORE

    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

    • Liam Allan Shares What’s Coming Next With Code For IBM i
    • From Stable To Scalable: Visual LANSA 16 Powers IBM i Growth – Launching July 8
    • VS Code Will Be The Heart Of The Modern IBM i Platform
    • The AS/400: A 37-Year-Old Dog That Loves To Learn New Tricks
    • IBM i PTF Guide, Volume 27, Number 25
    • Meet The Next Gen Of IBMers Helping To Build IBM i
    • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
    • Will Independent IBM i Clouds Survive PowerVS?
    • Now, IBM Is Jacking Up Hardware Maintenance Prices
    • IBM i PTF Guide, Volume 27, Number 24

    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