Finding the modified date time of a file


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Finding the modified date time of a file
# 1  
Old 01-27-2011
Finding the modified date time of a file

Hi,

I am new bie to Unix. Might be a simple question I am asking.

I want to find the last modified time of a file and find the difference between the currrent time and the last modified time. Appreciate, if someone can throw some light on what commands can be used.

Cheers,
James
# 2  
Old 01-28-2011
Well, stat() tells you the mtime in UNIX second GMT since 1970, and time() gives the time in same, and the ls and date commands use them. Also, there is a stat command for mtime:
Man Page for stat (All Section 1) - The UNIX and Linux Forums

A lot of the uses for these times are covered by the find -mtime option and the find -newer option with a marker file you 'touch'.
# 3  
Old 01-30-2011
What opaerating System and version are you running? It matters.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with finding the latest modified version of a file within directories

I am trying to look into multiple directories and pluck out the latest version of a specific file, regardless of where it sits within the directory structure. Ex: The file is a .xls file and could have a depth within the directory of anywhere from 1-5 Working directory - Folder1... (6 Replies)
Discussion started by: co21ss
6 Replies

2. Shell Programming and Scripting

how to change modified time of a file

A files last modified time is like 03/02/2012 xx:xx:xx So what would be the command to convert the last modified in the given signature Thanks for giving time and replying..:) (2 Replies)
Discussion started by: ezee
2 Replies

3. Emergency UNIX and Linux Support

Is there any way to set the files modified date and stamp to last modifies time?

Actually i did modification in a file on server by mistake, now its showing current time stamp, is there any way to set the files modified date and stamp to last modifies time. Please advice here.Thanks in advance.:b: (7 Replies)
Discussion started by: saluja.deepak
7 Replies

4. Shell Programming and Scripting

Reg file modified time

Hi, I have modified one file today. So if i give `ls -lrt filename` command it will show the current modified time. But i wanted to know what is the previous modified time for this file Is there any way to find this Thanks, Puni (3 Replies)
Discussion started by: puni
3 Replies

5. Shell Programming and Scripting

Finding the list of users who modified a file

Dear all, Need a quick help/suggestion on monitoring a particular directory . We have a deployment directory say (/users/integration/deploy ) under this there are several files which can be edited by a number of users - We need to write a script which will check this deployment directory... (5 Replies)
Discussion started by: jambesh
5 Replies

6. Shell Programming and Scripting

finding the file which is modified within last 2 hours

hi, I want to find a file which is modified within last 2 hours i am using sun-os i tried find . -name <filename> -mmin 120 i found that mmin option is not supported in sun-os is there any other alternative option suggestions welcome thanks in advance (5 Replies)
Discussion started by: trichyselva
5 Replies

7. Shell Programming and Scripting

Finding files older than the current date and time and renaming and moving

Hi, I have a very urgent requirement here. I have to find all files in the specified directory but not in the sub directories(The directory name is stored in a variable) which are older than the current date as well as current time and rename it as filename_yyyymmddhhmmss.ext and move it into a... (7 Replies)
Discussion started by: ragavhere
7 Replies

8. Shell Programming and Scripting

Finding modified File List after the chosen date in Korne Shell...

I am trying to write a Korne Shell asking the user for a date and a directory and then search recursively in this directory the list of files modified after the date chosen. But I am not getting good results when I Test it... #!/usr/bin/ksh echo "Enter a date (YYYYMMDD) " read date touch -t... (2 Replies)
Discussion started by: marconi
2 Replies

9. Solaris

Finding list of modified files for a particular time duration

Hi , I am trying to find out the List of files modified or added aftter installation of any component on SUN solaris box . But i am not able to do it using ls or find command . Can somebody help me out ? Thanks Sanjay Gupta (2 Replies)
Discussion started by: sanajyg_mnit
2 Replies

10. Shell Programming and Scripting

Finding out the last modified time for files

I need to find out the last modified time for the files which are older than 6 months. If I use ls -l, the files which are older than 6 months, I am just getting the day, month and year instead of exact time. I am using Korn shell, and SUN OS. Thanks in Advance, Kiran (3 Replies)
Discussion started by: kumariak
3 Replies
Login or Register to Ask a Question