file creation date including seconds


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users file creation date including seconds
# 1  
Old 08-22-2002
file creation date including seconds

Hi,

Is anybody can help me to get the file creation date with seconds?

-rw-r--r-- 1 opsc system 422550845 Aug 22 15:41 StatData.20020821

Thanks in advance

Krishna
# 2  
Old 08-22-2002
I don't know of any contemporary Unix filesystem that stores creation date/time at all.

Just modification time...
# 3  
Old 08-22-2002
an extention to LiveinFree's post.

as my perl book says the filessystem keeps the following times:
last asscess time, last modification time, last inode-change time.

you can get this info by useing stat.

man stat for more info.
# 4  
Old 08-22-2002
I do notice that your filename already has a datestamp on it....you could look at getting the datestamp that is used to create the file changed to include the seconds as well...

i.e.

filename=StatData\.`date +%Y%m%d%M%H%S`

It probably is currently set at (assuming it is scripted to set the date stamp on the file at the time of creation).

filename=StatData\.`date +%Y%m%d%`
# 5  
Old 08-25-2002
Sorry, I'm asking about file date&time below file date&time = Aug 22 15:41, here i will find only hh:mm, my question is how to see hh:mm:ss??????


-rw-r--r-- 1 opsc system 422550845 Aug 22 15:41 StatData.200208


Quote:
Originally posted by peter.herlihy
I do notice that your filename already has a datestamp on it....you could look at getting the datestamp that is used to create the file changed to include the seconds as well...

i.e.

filename=StatData\.`date +%Y%m%d%M%H%S`

It probably is currently set at (assuming it is scripted to set the date stamp on the file at the time of creation).

filename=StatData\.`date +%Y%m%d%`
# 6  
Old 08-26-2002
I see.... well in terms of creation date - the answer is you can't - it is not held at all. (Hence my suggestion about having the filenames changed to include the seconds).

If you're after the seconds for last modified - or last accessed....you might be able to do it if you can decipher this from the man page for ls (although that might only be for old files??)

Quote:
-l List in long format, giving mode, ACL indication,
number of links, owner, group, size in bytes, and time
of last modification for each file (see above). If the
file is a special file, the size field instead contains
the major and minor device numbers. If the time of
last modification is greater than six months ago, it is
shown in the format `month date year' for the POSIX
locale. When the LC_TIME locale category is not set to
the POSIX locale, a different format of the time field
may be used. Files modified within six months show
`month date time'.
# 7  
Old 08-26-2002
i tried from ls command, but could not get the seconds.

thanks
Krishna
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sftp file creation date and time

Hi Team, How to get the file creation date and time in SFTP server we can able to type ls -ltr command only SFTP server. Generally we type ls --full-time test.txt we will get the date and time , same way how to do in SFTP server after connected. Thanks (1 Reply)
Discussion started by: bmk123
1 Replies

2. UNIX for Dummies Questions & Answers

Change File Creation Date On Solaris

Dear Masters, I am using solaris 10. There is a requirement if a file created on Feb 1 or Feb 2, the creation date will be changed to Jan 31. Is there any command on Solaris to do that? Thanks, Kris (1 Reply)
Discussion started by: kris.adrianto
1 Replies

3. OS X (Apple)

How to get the file creation date with find command

Is it possible to find all files based on the date of creation? And if so, how? I've been looking at the find command but it seems that only modification times are used as an option. (1 Reply)
Discussion started by: Straitsfan
1 Replies

4. Shell Programming and Scripting

finding creation date of a file

Hi, Can anyone tell me a process to find the creation date of a file in a directory. If suppose I have a file in a directory created in 2009 -rw-r--r-- 1 xyz guest 2480 Jul 16 2009 sample.txt The command should return the the file creation date as 16/07/2009 thanks, (2 Replies)
Discussion started by: swathich
2 Replies

5. Shell Programming and Scripting

File creation time in seconds

Hi All, Cany any one help me in solving this.. Problem statement: I have a requirement to find the time from which there are no files created in a given directory. For this I am assuming that I need to get the file creation time in seconds, then the current time in seconds using `date +%s`.... (7 Replies)
Discussion started by: chary
7 Replies

6. Shell Programming and Scripting

how to find creation date of file

Hi, I just need to know way of getting date of file when it was created. eg i have a file abc created on 23 aug. Now i need to know date of file i.e. 23 aug. How can i get that data. Thanks Sarbjit (7 Replies)
Discussion started by: sarbjit
7 Replies

7. Shell Programming and Scripting

Command to get File Timestamp including seconds [Aix 5.3]

Is there a command (like ls -l) to get the file time stamp including seconds? The ls -l gives only the HH:MM, No SS I don't have a C compiler to call stat() I don't a command like stat too. Please help. (8 Replies)
Discussion started by: firdousamir
8 Replies

8. Shell Programming and Scripting

How to get File creation date.

Hi All, I need to get file creation date. I have to access one file who's name is like... abc.log092308 and the date changes as per current date. And i am accessing this file next day. meance in above case i will access above file on 09-24-2008 Also one problem is that this file... (2 Replies)
Discussion started by: Jeevan Salunke
2 Replies

9. UNIX for Dummies Questions & Answers

Changing Creation Date to a Prespecified Date of a File In Unix

Dear Expert, Is there a command to do that in Unix? In such a way that we don't need to actually "write" or modified the content. -- monkfan (4 Replies)
Discussion started by: monkfan
4 Replies

10. UNIX for Dummies Questions & Answers

Displaying file names before a particular creation date

Hi!! I wanna display file names which are created before/after a particular date. I wud be glad if anybody can help me out in that. Thanx Dhruv (1 Reply)
Discussion started by: dhruv_saksena
1 Replies
Login or Register to Ask a Question