• 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
    New Generation Software

    On Demand Video

    Data Visualization and Analytics
    with NGS-IQ and Microsoft Power BI

    Power BI is a popular visualization and analytics solution, but it’s only as good as the data your analysts can draw from your IBM i database.

    NGS-IQ simplifies and automates the cleansing, transformation, and delivery of IBM i data to Power BI reports and insights. Watch our new video to learn and see how NGS-IQ supports Power BI users while enabling you to maintain control and security.

    www.ngsi.com – 800-824-1220

    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

    • Power10 Boosts NVM-Express Flash Performance
    • Fortra Completes Postmortem Of GoAnywhere Vulnerability
    • Guru: Binding Directory Entries
    • How Does Your Infrastructure Spending Stack Up To The World?
    • IBM i PTF Guide, Volume 25, Number 22
    • Fortra Issues 20th State of IBM i Security Report
    • FNTS Launches Managed Services for Power Servers in IBM Cloud
    • Total LTO Shipped Capacity Up Slightly in 2022
    • Four Hundred Monitor, May 24
    • Update On Critical Security Vulnerability In PowerVM

    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 © 2023 IT Jungle