?
Solved

"find -mtime" differences AIX4 and AIX5

Posted on 2003-11-10
6
Medium Priority
?
4,006 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 500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

801 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