- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: MTIME Command
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2001 04:40 AM
10-17-2001 04:40 AM
MTIME Command
How can we display the files which are older than 3 days?? suppose today is 17th ..
I want to display the files from 12th to 14th..
Is there any option in the FIND Command???
Can any one help me in this matter??
Regards
Rajkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2001 04:53 AM
10-17-2001 04:53 AM
Re: MTIME Command
find . -type f -mtime +2 -a -mtime -11
Note: the -a (and) operator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2001 05:40 PM
10-17-2001 05:40 PM
Re: MTIME Command
Thank you for your reply..
I have a files in a /test directory.Todays date is 18th .Suppose i want to display the files which is older than 3 days..ie.,the files show display from 14th,13th,12th.
It should not use between those dates.......i mean there is no condition to display in between those dates..
dd/mm/yy File_names
----------------------------------
06/Oct/01 file06.cdr
07/Oct/01 file07.cdr
08/Oct/01 file08.cdr
09/Oct/01 file09.cdr
10/Oct/01 file10.cdr
11/Oct/01 file11.cdr
12/Oct/01 file12.cdr
13/Oct/01 file13.cdr
14/Oct/01 file14.cdr
15/Oct/01 file15.cdr
16/Oct/01 file16.cdr
17/Oct/01 file17.cdr
18/Oct/01 file18.cdr
Is it possible??
Thanks & Regards
Rajkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2001 06:15 PM
10-17-2001 06:15 PM
Re: MTIME Command
The 'mtime' argument to 'find' operates on a 24-hour offset based on the current day and time. If you want more granulatory or a fixed window, create two reference files and use the '-newer' argument to 'find'. By example:
# touch -m -t 10120001 /tmp/ref1
# touch -m -t 10142359 /tmp/ref2
# find /tmp -type f -newer /tmp/myref1 -a ! -newer /tmp/myref2 -exec ls -l {} \;
This will find all files in the /tmp directory modified between 10/12 at 00:01 and 10/14 at 23:59, regardless of the current date and time.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2001 06:36 PM
10-17-2001 06:36 PM
Re: MTIME Command
Thank you for your reply..
Is it possible to display the files in hours based..
suppose if i enter the number 10 hours or 0.5 (that means 1/2 an hours) is should display the files like that along with the letter starting with "a"....
Is it possible??
Regards
Rajkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2001 04:17 AM
10-18-2001 04:17 AM
Re: MTIME Command
If I understand your question correctly, then "no". The output from 'ls' shows dates and times in the format month, day-of-month and hh:mm unless the timestamp is older than 6-months. See the man pages for 'ls'.
BTW: It is a courtesy in this Forum to assign points to those who have helped you. In large part, this helps subsequent readers find answers and responses that helped solve a problem. Please see here for the official guidelines:
http://us-support.external.hp.com/estaff/bin/doc.pl/forward/screen=estaffAssistance/sid=927847dd187d8d7bbc?Page=file0002#forpoints
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2001 05:50 AM
10-18-2001 05:50 AM
Re: MTIME Command
I've put together a script which uses perl to give you the option of using find with a -older switch based on hours. All other arguments are treated as find arguments. So create the script:
========================================
#!/bin/ksh
args=$*
rest=$*
older=0
file=/tmp/tempfind.$$
echo $args |
grep -q -- "-older [^ ]*" && echo $args |
sed 's/\(.*\) -older \([^ ]*\)\(.*\)/\2 \1 \3/' |
read older rest
if [ $older -gt 0 ] ; then
perl -e '($sec,$min,$hour,$day,$mon,$year,$rest)=(localtime(time-$ARGV[0]*3600));
printf ("%04d%02d%02d%02d%02d.%02d\n",
$year+1900,$mon+1,$day,$hour,$min,$sec);' $older | read t
touch -m -t $t $file
rest="$rest ! -newer $file"
fi
find $rest
rm $file
======================================
Then you can issue something like:
./script.ksh /Database -type f -older 10.5 -mtime 8
to list any file older than 10.5 hours, but less than 8 days.
It's probably not foolproof, but may prove useful if you have perl loaded.
Rgds, Robin.