Using the filenames as the ONLY time reference:
Using file mtimes (last time written to, the default for ls -l )
The inode time ls -c abcd* is another internal time kept. This is almost always the file creation time. File creation time (birth time) is not universal, older UNIXes filesystems do not support it.
Since your question vague this is about the best we can do for you. We need your shell and your OS (uname -a shows this) to do better.
Last edited by jim mcnamara; 03-12-2019 at 12:32 PM..
This User Gave Thanks to jim mcnamara For This Post:
Hi,
I need to get the latest file from a list of files in a particular directory.
Please could anyone help me out to get the file.
Thank you,
- Jay. (1 Reply)
Hi guys,
I have a directory in UNIX having files with the below format, i need to pickup the latest file having recent timestamp embedded on it, then need to rename it to a standard file name.
Below is the file format:
filename_yyyymmdd.csv, i need to pick the latest and move it with the... (1 Reply)
Hi guys,
I have a directory in UNIX having files with the below format, i need to pickup the latest file having recent timestamp embedded on it, then need to rename it to a standard file name.
Below is the file format:
filename_yyyymmdd.csv, i need to pick the latest and move it with the... (2 Replies)
I was wondering if there was a command to move files from one directory to another subdirectory based on the timestamp, i.e. moving from directory A files that have a timestamp of before the year 2005 into directory B. Directory B is a subdirectory located in directory A. I was advised to... (4 Replies)
I have a few log files which get generated on a daily basis..So, I need to pick only the ones which get generated for that particular day.
-rw-r--r-- 1 staff 510732676 Apr 7 22:01 test.log040711
-rwxrwxrwx 1 staff 2147482545 Apr 7 21:30 test.log.2
-rwxrwxrwx 1 staff 2147482581 Apr 7 19:26... (43 Replies)
Hi Friends,
Newbie to shell scripting. Currently i have used the below to sort data based on filenames and datestamp
$ printf '%s\n' *.dat* | sort -t. -k3,4
filename_1.dat.20120430.Z
filename_2.dat.20120430.Z
filename_3.dat.20120430.Z
filename_1.dat.20120501.Z
filename_2.dat.20120501.Z... (1 Reply)
Hi Friends,
Newbie to shell scripting
Currently i have used the below to sort data based on filenames and datestamp
$ printf '%s\n' *.dat* | sort -t. -k3,4
filename_1.dat.20120430.Z
filename_2.dat.20120430.Z
filename_3.dat.20120430.Z
filename_1.dat.20120501.Z
filename_2.dat.20120501.Z... (12 Replies)
Hi,
I have a file which generate Timestamp in this format :-
20121012162354
20121114191610
20121210232808
20121216220002
20130106220002
20130127220001
20130203220001
20121012162354
20121114191610
20121210232808
20121216220002
20130106220002
20130127220001
20130203220001 (2 Replies)
we want to fetch the latest file in a given directory and also the file name should match the below pattern
Example file name ->hrdata-2015-10-13-16-45-26.xml(2015-10-13-16-45-26- it is not current timestamp, we just need to check for the pattern)
We expect the file will have the... (3 Replies)
Discussion started by: vishwanath001
3 Replies
LEARN ABOUT PHP
filectime
FILECTIME(3) 1 FILECTIME(3)filectime - Gets inode change time of fileSYNOPSIS
int filectime (string $filename)
DESCRIPTION
Gets the inode change time of a file.
PARAMETERS
o $filename
- Path to the file.
RETURN VALUES
Returns the time the file was last changed, or FALSE on failure. The time is returned as a Unix timestamp.
EXAMPLES
Example #1
A filectime(3) example
<?php
// outputs e.g. somefile.txt was last changed: December 29 2002 22:16:23.
$filename = 'somefile.txt';
if (file_exists($filename)) {
echo "$filename was last changed: " . date("F d Y H:i:s.", filectime($filename));
}
?>
ERRORS /EXCEPTIONS
Upon failure, an E_WARNING is emitted.
NOTES
Note
Note: In most Unix filesystems, a file is considered changed when its inode data is changed; that is, when the permissions, owner,
group, or other metadata from the inode is updated. See also filemtime(3) (which is what you want to use when you want to create
"Last Modified" footers on web pages) and fileatime(3).
Note
Note also that in some Unix texts the ctime of a file is referred to as being the creation time of the file. This is wrong. There
is no creation time for Unix files in most Unix filesystems.
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 filemtime(3).
PHP Documentation Group FILECTIME(3)