LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-24-2005, 09:47 AM   #1
digitalgravy
Member
 
Registered: Nov 2003
Posts: 86

Rep: Reputation: 15
archives, file timestamps and touch


I have a website and I want to modify some page elements but then restore the last modified time to what it was before I updated the file.

At the bottom of my pages I use php to read the last modified time of the document and print it to the page.

I have articles and other stuff that I do not want the time stamp to change, but I need to tweak the contents of the <head>. So nothing on the page is changing, just some meta tags.

The closest way I have found to do this would be to tar the whole site, make my changes, then read the time stamps from the files in the tar file, then use touch -mt to change the time stamps back.

How do I get the last modified timestamps from with in the tar file?
And can I have the timestamps outputted to a file with the time-stamp and the path?
Then How do I pipe that info to touch?

Is this possible?

What a headache, I'm going to do this kind of stuff with includes from now on so I don't need to worry about this again.

Any help would be appreciated.
 
Old 02-24-2005, 01:38 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Before you mod things:
Code:
find -printf "%p %CY%Cm%Cd%CH%CM.%CS\n" > times.txt
Afterwards:
Code:
cat times.txt|while read  file stamp; do touch -m -t$stamp $file; done

Cheers,
Tink
 
Old 02-24-2005, 09:34 PM   #3
digitalgravy
Member
 
Registered: Nov 2003
Posts: 86

Original Poster
Rep: Reputation: 15
Thanks,

I asked a different way a few weeks ago, and got no help. Ill try it.

Thanks again

-Jacob
 
Old 02-24-2005, 09:56 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally posted by digitalgravy
Thanks,

I asked a different way a few weeks ago, and got no help. Ill try it.

Thanks again

-Jacob
I know ;)


I remembered it, and first checked what the responses
from the last thread were!



Hih.


Cheers,
Tink
 
Old 02-28-2005, 12:44 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally posted by digitalgravy
Thanks,

I asked a different way a few weeks ago, and got no help. Ill try it.

Thanks again

-Jacob
And? Did it work? :)


Cheers,
Tink
 
Old 03-01-2005, 09:27 AM   #6
digitalgravy
Member
 
Registered: Nov 2003
Posts: 86

Original Poster
Rep: Reputation: 15
It works!

That is exactly what I was looking for.

Thanks Again!
 
Old 02-08-2006, 07:47 PM   #7
digitalgravy
Member
 
Registered: Nov 2003
Posts: 86

Original Poster
Rep: Reputation: 15
It's been awhile

Quote:
Originally Posted by Tinkster
Before you mod things:
Code:
find -printf "%p %CY%Cm%Cd%CH%CM.%CS\n" > times.txt
Afterwards:
Code:
cat times.txt|while read  file stamp; do touch -m -t$stamp $file; done

Cheers,
Tink
I had been getting mixed results with this. Some of the times were showing up incorrect. I use this technique once in a while. Well what is happening is the original command specified %C which returns the last Status Change. I need it to show the last modification time. For this you use %T.

Code:
find -printf "%p %TY%Tm%Td%TH%TM.%TS\n" > times.txt
This returns exactly what I want.

Thanks Tinkster, you got me in the right direction!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
no file access timestamps being updated! takahaya Linux - General 4 04-03-2005 06:48 PM
Multi-volume file archives JoshSmith41 Linux - Software 3 07-05-2004 06:42 PM
VSFTPD and file timestamps t3___ Linux - Newbie 4 01-21-2004 02:26 PM
converting log file timestamps mrtwice Linux - Software 3 09-22-2003 09:45 AM
modify file access & modify timestamps i2itstud Linux - General 1 05-20-2003 03:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration