The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > AIX
Google UNIX.COM


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
move file change timestamp tekster757 UNIX for Dummies Questions & Answers 2 08-10-2007 10:01 AM
change timestamp of file isingh786 HP-UX 1 05-15-2006 10:56 AM
get a file's timestamp shihabvk UNIX for Advanced & Expert Users 1 05-30-2005 03:18 AM
checking file's permissions and change them K-ONE Shell Programming and Scripting 7 04-10-2005 06:09 AM
Timestamp of File permission change jyotipg UNIX for Advanced & Expert Users 1 02-18-2003 11:02 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-12-2008
Registered User
 

Join Date: Apr 2008
Posts: 6
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Change a file's timestamp

Hi,

I want to modify a file and then change the file's timestamp back to what it was before the modification. It should look as if the file has'nt been modifed. The entire operation needs to be done inside a ksh script. Can anyone suggest how I can trap a file's stamp in a variable within a shell.

Thanks in advance.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-12-2008
Registered User
 

Join Date: Apr 2008
Location: Bangalore
Posts: 120
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Hi,

Try touch command

if files present time stamp is may 10 10:24

Modify ur file, then give the following command

touch -t 200805101024 filename

Decomposition of 200805101024
2008 year , 05 - month number , date, time


Thanks
Penchal
Reply With Quote
  #3 (permalink)  
Old 05-13-2008
Registered User
 

Join Date: Apr 2008
Posts: 6
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Thanks for the response. I used touch -t several times. What I wanted to know is, how to trap the timestamp of the file within a shell in a format which can be fed to "touch" command. I want to get the file's timestamp in YYYYMMDDHHMI format.

Thanks in advance.
Reply With Quote
  #4 (permalink)  
Old 05-13-2008
Registered User
 

Join Date: Apr 2008
Location: Bangalore
Posts: 120
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
ls -ltr filename
_rw_rw_rw_ 1 penchal grp 1024 May 13 18:08 filename


Ur timestamp becomes : 200805131808
Reply With Quote
  #5 (permalink)  
Old 05-27-2008
Registered User
 

Join Date: Aug 2005
Posts: 9
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Sounds like someone is trying to do something fishy "file should appear as if it has not been modified" . Anyways, I have a question about the modification time for a symbolic link.

foo.c -> apps/gendev/src/foo.c

the timestamp on apps/gendev/src/foo.c is say 'May 27 11:37'

the timestamp on foo.c (which points to the source file) is 'May 27 10:42' which is when the link was created. Everytime I edit foo.c from my directory the timestamp on apps/gendev/src/foo.c is updated which I understand because I am really modifying that file. I want to know if there is a way to modify the timestamp on the link without relinking the file?

Thanks
Reply With Quote
  #6 (permalink)  
Old 05-27-2008
Moderator
 

Join Date: Feb 2007
Posts: 1,387
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
rcarnesiii.

Please don't hijack another ones thread but open a new thread for your question.

Thanks.
Reply With Quote
  #7 (permalink)  
Old 05-27-2008
Dave Miller's Avatar
Registered User
 
Join Date: Dec 2007
Location: Northern NJ, USA
Posts: 140
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Quote:
Originally Posted by penchal_boddu View Post
ls -ltr filename
_rw_rw_rw_ 1 penchal grp 1024 May 13 18:08 filename


Ur timestamp becomes : 200805131808
FYI: The time is only shown if the timestamp is less than 6 months old. If it's more than 6 months, the ls command shows the year instead of time.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes


The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
421 service not available, remote server has closed connection ^m automate ftp autosys awk trim bash eval bash for loop boot: cannot open kernel/sparcv9/unix command copy/move folder in unix couldn't set locale correctly curses.h cut command in unix daemon process find grep find mtime find null character in a unix file grep multiple lines grep or grep recursive hp-ux ifconfig inaddr_any inappropriate ioctl for device lynx javascript mailx attachment mget mtime perl array length ping port remove first character from string in k shell replace space by comma , perl script scp recursive segmentation fault(coredump) sftp script snoop unix stale nfs file handle syn_sent tar exclude tar extract to folder test: argument expected unix unix .profile unix forum unix forums unix internals unix interview questions unix mtime unix simulator unix.com vi substitute while loop within while loop shell script


All times are GMT -7. The time now is 01:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101