Solved

"find -mtime" differences AIX4 and AIX5

Posted on 2003-11-10
6
4,004 Views
Last Modified: 2013-12-06
Hi!

The definition of "find -mtime" changed!

find all files changed between 24-48 hours
AIX4: find . -mtime 2
AIX5: find . -mtime 1

find all files changed between 48-72 hours
AIX4: find . -mtime 3
AIX5: find . -mtime 2

find all files changed between 0-24 hours
AIX4: find . -mtime 1
AIX5: find . -mtime 0

find all files changed between 0-48 hours
AIX4: find . -mtime -2
AIX5: ???
AIX5: find . -mtime -1 -> returns all files changes between 24-48
AIX5: find . -mtime -2 -> returns all files changes between 24-72

BUT HOW TO find all files between 0 and 48/72/... hours???

thx
michi
0
Comment
Question by:witty
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 9719366
Here's what you can do, create a stamp file first, than use find.
eg, to find all the files 0-72 hrs, you do: (I use ksh/bash/sh shell systax)

STAMP=`TZ=$TZ+72 date  +%Y%m%d%H%M`
touch -t $STAMP mystamp

find . -newer mystamp -print
0
 
LVL 38

Expert Comment

by:yuzh
ID: 9736303
how's it going, need more help?
0
 
LVL 1

Author Comment

by:witty
ID: 9741145
@yuzh:

thanks for your comment:
... but creating a temporary file is no solution :-(
any other idea?

thx
michi
0
 
LVL 38

Accepted Solution

by:
yuzh earned 125 total points
ID: 9744409
Well, I have not used an AIX box for a while now, and don't have AIX 5.x on hand
for testing:

In normal condition:

find . -mtime -n
should return all the files modified in 0 - n*24 hours (this working fine in Solaris,
HP-UX, FreeBDS, Linux, SCO ....!)

If "find" behave the way as you mentioned above,  you better use a tmp file.
(it cost you nothing 0 byte, if you use it in a script, you can clean it up
after "find"),  otherwise, you have to use "for/while" loop, to do multiple "find"!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

696 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