Timestamp of old files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Timestamp of old files
# 1  
Old 11-04-2009
Timestamp of old files

Hi
I have a question if i give ls -ltr i get in the following order
I dont get time stamp of old files where as the latest ones have time stamp
How can i get the timestamp in the old files of 2008 and the one file of Jan 2009

-rw-rw-r-- 1 console staff 204 Nov 19 2008 msg
-rw-rw-r-- 1 console staff 296 Nov 24 2008 adj
-rwx--x--x 1 console staff 11557920 Dec 9 2008 file
-rw-rw-r-- 1 console staff 202 Jan 28 2009 test.msg
-rw-r--r-- 1 console staff 11557920 Jan 29 2009 test1
-rwx--x--x 1 console staff 130952 Sep 23 4:32 ram
-rwx--x--x 1 console staff 1299800 Sep 23 4:32 sum
-rwx--x--x 1 console staff 639504 Sep 23 4:32 system


Thanks in advance
# 2  
Old 11-04-2009
Depends on what version of Unix we are talking about?

Try stat(1):
Code:
stat filename

e.g.:
Code:
$ stat fstab
  File: `fstab'
  Size: 480           Blocks: 8          IO Block: 4096   regular file
Device: 805h/2053d    Inode: 3931634     Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2009-11-04 13:53:25.000000000 +0000
Modify: 2008-12-13 22:52:49.000000000 +0000
Change: 2008-12-13 22:52:49.000000000 +0000
$

# 3  
Old 11-04-2009
ls on Linux has the --full-time option.
# 4  
Old 11-09-2009
Thanks for your answers stat in my unix is not giving the desired result , it is working just like cat

On the other hand
ls --full-time is working well in linux giving the desired result
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Listing of files between two timestamp

Hi, I want to list down the files between two timestamp. But I can not use newer or newermt command as it doesn't support these tokens. Is there any other way to achieve this? Else I have to write too much of coding . Input Dec 01 02:02 Dec 02 05:07 (8 Replies)
Discussion started by: Abhijit Sen
8 Replies

2. Shell Programming and Scripting

Excluding files with timestamp from ls

Hi, I have a list of files all starting with aa but some of them also have a timestamp suffixed which I want to remove from my search. For e.g. aa1 aa2 aa.15-05-25_20:41:05.20150611 aa.15-05-26_20:29:40.20150611 aa.15-05-27_20:28:32.20150611 If I do ls -1 aa*, it will list everything... (7 Replies)
Discussion started by: swasid
7 Replies

3. Shell Programming and Scripting

To check timestamp in logfile and display lines upto 3 hours before current timestamp

Hi Friends, I have the following logfile. Currently time in india is 07/31/2014 12:33:34 and i have the following content in logfile. I want to display only those entries which contain string 'Exception' within last 3 hours. In this case, it would be the last line only I can get the... (12 Replies)
Discussion started by: srkmish
12 Replies

4. Shell Programming and Scripting

Identifying files with a timestamp greater than a given timestamp

I need to be able to identify files with file timestamps greater than a given timestamp. I am using the following solution, although it appears to compare files at the "seconds" granularity and I need it at the milliseconds. When I tested my solution, it missed files that had timestamps... (3 Replies)
Discussion started by: nkm0brm
3 Replies

5. Shell Programming and Scripting

sort the files based on timestamp and execute sorted files in order

Hi I have a requirement like below I need to sort the files based on the timestamp in the file name and run them in sorted order and then archive all the files which are one day old to temp directory My files looks like this PGABOLTXML1D_201108121235.xml... (1 Reply)
Discussion started by: saidutta123
1 Replies

6. Shell Programming and Scripting

How to split a file into exactly two files by timestamp?

2009-10-29 03:39:11,720 INFO - Optimize cache for minimal puts: disabled 2009-10-29 03:39:11,720 INFO - Structured second-level cache entries: disabled 2009-10-29 03:39:22,687 WARN - Problem starting service jboss.web.deployment:war=dt-sp-fabric-delegate-ws-war-3.5.0.war,id=1483428821... (3 Replies)
Discussion started by: maheshshinde
3 Replies

7. HP-UX

to get the timestamp of files from the files and folders in Unix

Hi, I had a directory and many subdirectories and files with in it. Now i want to get the timestamp of files from the files and folders recursively. :( Please help me to generate a script fort he above mentioned requirement! Appreciate for ur qick response Thanks in advance! ... (2 Replies)
Discussion started by: kishan
2 Replies

8. Shell Programming and Scripting

how to compare the timestamp of 2 files

i want to compare the timestamp of the 2 file.. please let me know how we can achive this.. (2 Replies)
Discussion started by: mail2sant
2 Replies

9. AIX

How do i check if 2 files have same timestamp?

How can i compare the time stamps of two files to check if they are the same. Is there any option like the -nt or -ot with the if clause? I have a file and i "cp -p" the file to a different location. If a copy of the file already exists, i dont want to copy it. I am also running multiple instances... (1 Reply)
Discussion started by: pt14
1 Replies

10. Shell Programming and Scripting

comparing timestamp of two files

Hi! I need to copy a whole bunch of file from a build directory to my working directory. Many of these files already exist in my working directory. I need to copy only those files that have been modified since I last copied.. How do I compare the timestamp of two files, so that I would copy... (2 Replies)
Discussion started by: jyotipg
2 Replies
Login or Register to Ask a Question