Hi
I've made some test with perl script to learn more about mtime...
So, my question is :
Why the mtime from find
are not the same as mtime from unix/linux in
or in stat() function in perl : stat - perldoc.perl.org
Quote:
9 mtime last modify time in seconds since the epoch
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)
...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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT PHP
stat
STAT(3) 1 STAT(3)stat - Gives information about a fileSYNOPSIS
array stat (string $filename)
DESCRIPTION
Gathers the statistics of the file named by $filename. If $filename is a symbolic link, statistics are from the file itself, not the sym-
link.
lstat(3) is identical to stat(3) except it would instead be based off the symlinks status.
PARAMETERS
o $filename
- Path to the file.
RETURN VALUES stat(3) and fstat(3) result format
+--------+--------------------------------------+---+
|Numeric | | |
| | | |
| | Associative | |
| | | |
| | Description | |
| | | |
+--------+--------------------------------------+---+
| 0 | | |
| | | |
| | dev | |
| | | |
| | device number | |
| | | |
| 1 | | |
| | | |
| | ino | |
| | | |
| | inode number * | |
| | | |
| 2 | | |
| | | |
| | mode | |
| | | |
| | inode protection mode | |
| | | |
| 3 | | |
| | | |
| | nlink | |
| | | |
| | number of links | |
| | | |
| 4 | | |
| | | |
| | uid | |
| | | |
| | userid of owner * | |
| | | |
| 5 | | |
| | | |
| | gid | |
| | | |
| | groupid of owner * | |
| | | |
| 6 | | |
| | | |
| | rdev | |
| | | |
| | device type, if inode device | |
| | | |
| 7 | | |
| | | |
| | size | |
| | | |
| | size in bytes | |
| | | |
| 8 | | |
| | | |
| | atime | |
| | | |
| | time of last access (Unix timestamp) | |
| | | |
| 9 | | |
| | | |
| | mtime | |
| | | |
| | time of last modification (Unix | |
| | timestamp) | |
| | | |
| 10 | | |
| | | |
| | ctime | |
| | | |
| | time of last inode change (Unix | |
| | timestamp) | |
| | | |
| 11 | | |
| | | |
| | blksize | |
| | | |
| | blocksize of filesystem IO ** | |
| | | |
| 12 | | |
| | | |
| | blocks | |
| | | |
| | number of 512-byte blocks allocated | |
| | ** | |
| | | |
+--------+--------------------------------------+---+
* On Windows this will always be 0.
** Only valid on systems supporting the st_blksize type - other systems (e.g. Windows) return -1.
In case of error, stat(3) returns FALSE.
Note
Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results
for files which are larger than 2GB.
ERRORS /EXCEPTIONS
Upon failure, an E_WARNING is emitted.
EXAMPLES
Example #1
stat(3) example
<?php
/* Get file stat */
$stat = stat('C:phpphp.exe');
/*
* Print file access time, this is the same
* as calling fileatime()
*/
echo 'Access time: ' . $stat['atime'];
/*
* Print file modification time, this is the
* same as calling filemtime()
*/
echo 'Modification time: ' . $stat['mtime'];
/* Print the device number */
echo 'Device number: ' . $stat['dev'];
?>
Example #2
Using stat(3) information together with touch(3)
<?php
/* Get file stat */
$stat = stat('C:phpphp.exe');
/* Did we failed to get stat information? */
if (!$stat) {
echo 'stat() call failed...';
} else {
/*
* We want the access time to be 1 week
* after the current access time.
*/
$atime = $stat['atime'] + 604800;
/* Touch the file */
if (!touch('some_file.txt', time(), $atime)) {
echo 'Failed to touch file...';
} else {
echo 'touch() returned success...';
}
}
?>
NOTES
Note
Note that time resolution may differ from one file system to another.
Note
The results of this function are cached. See clearstatcache(3) for more details.
Tip
As of PHP 5.0.0, this function can also be used with some URL wrappers. Refer to "Supported Protocols and Wrappers" to determine
which wrappers support stat(3) family of functionality.
SEE ALSO lstat(3), fstat(3), filemtime(3), filegroup(3).
PHP Documentation Group STAT(3)