Operating System - HP-UX
1830212 Members
1437 Online
109999 Solutions
New Discussion

List create date of a file

 
SOLVED
Go to solution
Patrick Chim
Trusted Contributor

List create date of a file

Hi all,

If I have modified a file or get a file through ftp, the date/time of that file will change. Is it possible to list out the actual create date/time of the file ?

Thanks,
Patrick
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor
Solution

Re: List create date of a file

Hi Patrick:

Unfortunately, there is no creation timestamp that is distinct from the modification timestamp. The 'ls -l' command reports the modification timestamp. 'ls -lc' returns the timestamp for which the last permission or ownership change occured. 'ls -lu' returns the lastaccess timestamp.

...JRF...
Sridhar Bhaskarla
Honored Contributor

Re: List create date of a file

Patrick,

If you want to preserve the time stamp of the ftp'ed file, you need to do some work arounds. During your ftp session, you can view the stamp of the file by doing a "dir" at the ftp prompt and note the time stamp. After downloading the file you can use "touch" command to change the time stamp.

If it is a non-interactive ftp session, redirect your ftp output to a file. grep for the listing of file and get the timestamp field by awking the line and then touch the ftp'ed file touching it with this stamp.

If you have control over the remote site, instead of ftp'ing the original file, tar it and then ftp the tar ball. Once the tar is untar'ed, you will get the file with the original time stamp.

Cumbersome. But possible.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Magdi KAMAL
Respected Contributor

Re: List create date of a file

Hi Patrick,

With ftp, there is no way to preserve the initial file creation date and time.

BUT, with remote copy "rcp" you can preserve it by using the option "-p".

#rcp -p server1:/home/user1/.profile /tmp/.profile

Will remote copy file ".profile" from server1 under directory /home/user1 to local server under /tmp.

Magdi