• 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
    Manta Technologies

    The Leader in IBM i Education!
    Need training on anything i?
    Manta is all you need.

    Courses and competency exams on:
    · IBM i operations
    · System Management and Security
    · IBM i Programming Tools
    · Programming in RPG, COBOL, CL, Java
    · Web Development

    SQL, DB2, QueryProduct features:
    · Runs in every popular browser
    · Available 24/7/365
    · Free Student Reference Guides
    · Free Student Administration
    · Concurrent User License
    · Built-In IBM i Simulator

    You can download our 200-page catalog and take sample sessions at MantaTech.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Reader Feedback and Insights: One-Row Table Still Needed Performance of the SQL LIKE Predicate

    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

    • IBM Gets Bob 1.0 Off The Ground
    • You Store The Crown Jewels In A Safe, Not In A Bucket
    • More Power Systems Withdrawals, And Some From Red Hat, Too
    • Price Increases Are Here, Or Pending, And For Sure For Memory
    • IBM i PTF Guide, Volume 28, Number 9
    • After A Few Short Years, VS Code Passes Rational Developer for i
    • Why Logical Replication Has Become The New Standard for IBM i HA/DR
    • Guru: Managing The Lifecycle Of Your Service Programs – Updates Without Chaos
    • IT Spending Forecast Keeps Going Up And Up, But It Won’t Go Away
    • IBM i PTF Guide, Volume 28, Number 8

    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