Solved

"find -mtime" differences AIX4 and AIX5

Posted on 2003-11-10
6
3,997 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
  • 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

746 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now