Last modified time of the folder is changing when I view the file inside the directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Last modified time of the folder is changing when I view the file inside the directory
# 1  
Old 11-26-2010
Last modified time of the folder is changing when I view the file inside the directory

Hi.,

Last modified time of the folder is changing when I view the file inside the directory. Here is the test on sample directory. I believe that ls -l commands gives the time detail w.r.t last modified time. Pl. suggest.

HTML Code:
bash-3.2$ mkdir test
  bash-3.2$ cd test
  bash-3.2$ touch myfile.txt
  bash-3.2$ ls -l
  total 0
  -rw-r--r-- 1 avv avvgrp 0 Nov 26 03:51 myfile.txt
   
  bash-3.2$ cd ..
   
  bash-3.2$ ls -l test/
  total 0
  -rw-r--r-- 1 avv avvgrp 0 Nov 26 03:51 myfile.txt 



bash-3.2$ ls -lrt | tail -1 

drwxr-xr-x 2 avv avvgrp  4096 Nov 26 03:51 test
   
  bash-3.2$ vi test/myfile.txt
   
   
  q!   ---- here I have not modified the file. And executed quit without saving command. 

   
  bash-3.2$ ls -lrt | tail -1
  drwxr-xr-x 2 avv avvgrp  4096 Nov 26 03:53 test
Timestamp of the folder has changed after I viewed the file, as indicated above. Pl. suggest.


Thanks.,
# 2  
Old 11-26-2010
Code:
man stat

Code:
stat yourfolder

This User Gave Thanks to ctsgnb For This Post:
# 3  
Old 11-26-2010
When you open a file with vi a hidden swap-file is created (to recover your vi-session in case vi crashes). That file is deleted when you exit vi in a normal way. That deletion (and before that the creation of the swap-file) causes the change of the timestamp.
This User Gave Thanks to cero For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Unsure why access time on a directory change isn't changing

Hello... And thanks in advance for any help anyone can offer me I was trying to work out the differences between displaying modify, access, and change times with the 'ls' command. Everything seems in order when I look at files, but the access time on a directory doesn't seem to change when I... (4 Replies)
Discussion started by: bodisha
4 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. Shell Programming and Scripting

changing a file when the inode modified time of the other file changes

i have a requirement where i needed to change variable values in a properties file(first file) whenever there is change to Release details file(second file). My question is do i have to create a daemon process that always checks the modified time/inode change of the second file and then change the... (1 Reply)
Discussion started by: saikiran_1984
1 Replies

4. UNIX for Advanced & Expert Users

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 Replies)
Discussion started by: JamesJoe
2 Replies

5. 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

6. Shell Programming and Scripting

CHANGING THE TEXT INSIDE A FILE

Hi All, I need a small help in formating a file. I have a file with word like this; ATGHYJIKOLFHJDHDGDYFGFYGRYGFYRHFYHFUED DHDJFDFSJFLFJSKJFSLKJFGHDKLGLDKGLKDNVNV VNLDVLDVDHFJDKDJVNVHSUFNHJFMVJFMVKJMFV ... .... ....like this 75000 words. I want to convert this words into a single... (5 Replies)
Discussion started by: Lucky Ali
5 Replies

7. UNIX for Advanced & Expert Users

how to open a last modified file in a directory

how to directly open a last modified file in a directory? Please help (5 Replies)
Discussion started by: apsprabhu
5 Replies

8. Shell Programming and Scripting

changing modified time

How to change the modified time of a file to any specified time. ls -ltr drwxr-xr-x 2 pipe pipe 4096 Jun 10 10:33 coredump_06062008 ---------------------------------------------------------------------- here file coredump_06062008 last modified time is Jun 10 10:33 and i... (1 Reply)
Discussion started by: ali560045
1 Replies

9. UNIX for Dummies Questions & Answers

deleting files based on file name and modified time

Hi, I have some log files created in the following fashion Ex: file name modified date 1) s.log1 01-jan-08 2) s.log2 02-jan-08 3) s.log3 03-jan-08 4) s.log4 04-jan-08 Now I want to have the latest 2 logs and delete the others. Can you tell me the one liner /... (1 Reply)
Discussion started by: ammu
1 Replies
Login or Register to Ask a Question