Sponsored Content
Top Forums UNIX for Dummies Questions & Answers (find) mtime vs. (unix) mtime Post 302380134 by hiddenshadow on Monday 14th of December 2009 10:34:56 AM
Old 12-14-2009
(find) mtime vs. (unix) mtime

Hi
I've made some test with perl script to learn more about mtime...
So, my question is :
Why the mtime from find
Code:
find /usr/local/sbin  -ctime -1 -mtime -1 \( -name "*.log" -o -name "*.gz" \) -print

are not the same as mtime from unix/linux in
Code:
ls -ltr

or in stat() function in perl : stat - perldoc.perl.org
Quote:
9 mtime last modify time in seconds since the epoch
Are they really many mtime in unix???

Thanks a lot for your help....
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

find -mtime off by one day?

If I use the find command to find files older than n days I have to enter find . -mtime +(n-1). I tried this on a Solaris 9 system and also Linux. Is this something that all Unix veterans know about (I'm new to Unix)? If so, maybe my man pages need to be updated (how to do this?). :confused: (4 Replies)
Discussion started by: ceanntrean
4 Replies

2. UNIX for Dummies Questions & Answers

find . -mtime

...what am i doing wrong?? I need to find all files older than 30 days and delete but I can't get it to pull details for ANY + times. The file below has a time stamp which is older than 1 day, however if I try and select it using any of the -time flags it just doesn't see it. (the same thing... (1 Reply)
Discussion started by: topcat8
1 Replies

3. UNIX for Dummies Questions & Answers

problem with find and mtime

I am using HP-UNIX , The below command doesnt display anything although i have changed a file in the directory by toutch -t 200010101800 nfile find /tmp/transfer/ -name "*.*" -mtime +1 Any problrm with the find command i written . .Please help ??.. Thanks, Arun (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

4. UNIX for Dummies Questions & Answers

find -mtime query

Hello everyone, I have got two queries: 1) I want to do some work on files that were last modified yesterday. Will find ... -mtime -2 be correct or -mtime-1? 2)What about finding files that were modified today? Will it be -mtime -0 or -mtime -1? Thanks. (1 Reply)
Discussion started by: Rajat
1 Replies

5. UNIX for Dummies Questions & Answers

find mtime syntax

Hi guys, I am looking for a way of moving all files out of a directory with a time stamp greater then the one I specify. Can anyone suggest a way of doing so? For example, move all files out of dir1 which were created after 17:00 into dir2. Thanks :) (1 Reply)
Discussion started by: JayC89
1 Replies

6. Shell Programming and Scripting

Find + prune + mtime

Hi, i try to catch all files in a dir ,without going down in subdir , which don't have file extension and older than 10 days for example: my dir : drwxr-xr-x 7 notes01 notes 4096 Mar 8 14:11 . drwxr-xr-x 116 root system 4096 Mar 9 11:17 .. -rw-r----- 1 notes01... (4 Replies)
Discussion started by: Nicol
4 Replies

7. Shell Programming and Scripting

What is -mtime 0 in find command?

What is "-mtime 0" option in find command. Does it consider the files that are of today lets say today is 4th Aug or will include files 24 hrs past from the current time???? (3 Replies)
Discussion started by: sachinkl
3 Replies

8. Shell Programming and Scripting

find -mtime +7

Dear all, find $ADMIN_DIR/$SID/arch/ -name '*.gz' -mtime +7 -exec rm {} \; is it retaining 7 days OR 8 days .gz files ? Thanks Prakash (10 Replies)
Discussion started by: prakashoracledb
10 Replies

9. UNIX for Dummies Questions & Answers

Find using mtime

Hi, so I was using mtime and its not behaving the way I would think its supposed too. I have two pdf files. One modified today and another 6 months ago. I upload them to the solaris server. Then I run the below find statements. This finds my 2 files find *.pdf -type f -name '*.pdf' this finds... (2 Replies)
Discussion started by: vsekvsek
2 Replies

10. Shell Programming and Scripting

Find by name and mtime

Hi, I'm trying to find all files that have a .ksh and .p extension and that are 7 days old by using the below find command but it doesn't seem to as expected. It gives me random results.. Can someone point out what may be wrong? find . -name "*.ksh" -o -name "*.p" -mtime -7 (2 Replies)
Discussion started by: Jazmania
2 Replies
STAT(5) 							File Formats Manual							   STAT(5)

NAME
stat, wstat - inquire or change file attributes SYNOPSIS
Tstat tag[2] fid[2] Rstat tag[2] fid[2] stat[116] Twstat tag[2] fid[2] stat[116] Rwstat tag[2] fid[2] DESCRIPTION
The stat transaction inquires about the file identified by fid. The reply will contain a 116-byte (DIRLEN in <libc.h>) machine-independent directory entry laid out as follows: name[28] file name; must be / if the file is the root directory of the server uid[28] owner name gid[28] group name qid.path[4] the file server's identification for the file qid.vers[4] version number for given path mode[4] permissions and flags atime[4] last access time mtime[4] last modification time length[8] length of file in bytes type[2] for kernel use dev[2] for kernel use Integers in this encoding are in little-endian order (least significant byte first). The convM2D and convD2M routines (see fcall(2)) con- vert between directory entries and C structs. This encoding may be turned into a machine dependent Dir structure (see stat(2)) using routines defined in fcall(2). The mode contains permission bits as described in intro(5) and the following: 0x80000000 (this file is a directory), 0x40000000 (append only), 0x20000000 (exclusive use). Writes to append-only files always place their data at the end of the file; the offset in the read or write message is ignored, as is the OTRUNC bit in an open. Exclusive use files may be open for I/O by only one fid at a time across all clients of the server. If a second open is attempted, it draws an error. Servers may implement a timeout on the lock on an exclusive use file: if the fid holding the file open has been unused for an extended period (of order at least minutes), it is reasonable to break the lock and deny the initial fid further I/O. The two time fields are measured in seconds since the epoch (Jan 1 00:00 1970 GMT). The mtime field reflects the time of the last change of content. For a plain file, mtime is the time of the most recent create, open with truncation, or write; for a directory it is the time of the most recent remove, create, or wstat of a file in the directory. Similarly, the atime field records the last read of the contents; also it is set whenever mtime is set. In addition, for a directory, it is set by an attach, walk, or create, all whether successful or not. The length records the number of bytes in the file. Directories and most files representing devices have a conventional length of 0. The stat request requires no special permissions. The wstat request can change some of the file status information. The name can be changed by anyone with write permission in the parent directory; it is an error to change the name to that of an existing file. The mode and mtime can be changed by the owner of the file or the group leader of the file's current group. The directory bit cannot be changed by a wstat; the other defined permission and mode bits can. The gid can be changed: by the owner if also a member of the new group; or by the group leader of the file's current group if also leader of the new group (see intro(5) for more information about permissions and users(6) for users and groups). None of the other data can be altered by a wstat. In particular, there is no way to change the owner of a file. A read of a directory yields an integral number of directory entries in the machine independent encoding given above (see read(5)). ENTRY POINTS
Stat messages are generated by fstat and stat. Wstat messages are generated by fwstat and wstat. STAT(5)
All times are GMT -4. The time now is 12:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy