Print Post Setting the Timestamp on UNIX files

I recently removed a file in UNIX accidentally – I was running commands from my command history and thought I was after the second most recent command, rather than the third most recent command.

Luckily, I’d kept a copy of the file on my Windows system, so all I wanted to do was to put the file back. As expected, though, when I put the new file over, it took the UNIX timestamp rather than the Windows one. One of the first things that I check for when comparing a development and production environment, if something works in one environment and not in the other, is the timestamps on the two files – if they are the same then the chances are that the files are identical. This isn’t always true, but I’ve always found it a good starter for 10.

So, now I have a file in UNIX that is dated today, when it should have been date three months ago, and I wanted to change the timestamp. In Windows, I’ve got a utility that I can enter the new timestamp, and it updates the file information – in UNIX there is a standard command to do it!

If you run the touch command, you can provide a timestamp that it puts against the file, so all I needed was to run

touch -t 200703062257 [filename]

and the system set the timestamp on the file to 06-MAR-2007 at 22:57 – exactly what I wanted to hide my error in deleting files!

This is probably old-hat to someone who knows UNIX well, but it saved me having to remember the dates that I messed up files, and at least now I have somewhere I can always search to remind me how it’s done!!

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Ping.fm Post to Reddit Post to StumbleUpon

This entry was posted on Wednesday, November 5th, 2008 at 4:18 pm and is filed under General Computing, Technical. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

« FYI or Response Required notifications – Follow up
Hacking Access to Oracle e-Business Suite via Workflow »

Leave a Reply

  • Pages

    • About Us
    • Services From WorkflowFAQ
    • Training
    • Workflow Book
    • Careers
    • Forum
    • Blog
  • Oracle 11i Workflow Certified Expert
    Oracle 11i System Administrator Certified Expert

  • Blog

    Archives

    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • December 2009
    • October 2009
    • August 2009
    • July 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
  • Categories

    • General Computing (27)
    • Non-Oracle (14)
    • Oracle (49)
      • Functional (6)
      • Technical (44)
    • Personal (2)
    • Uncategorized (1)

  • Links

  • General Computing

    • Computing Magazine
    • Download.com
    • SourceForge.net
    • The Daily WTF
    • The Register
  • Non-Computing

    • BBC News
    • Cuteable
    • My wife’s shop
    • The Guardian
  • Oracle Related

    • AppsDBA
    • Oracle
    • Oracle Apps Blog
    • Oracle Magazine Interactive
    • Oracle Support
    • Oracle Technology Network
    • Oracle UK
    • Oracle Workflow Forum on OTN
    • Oracle WTF
    • OraFAQ
    • Steven Chan
    • Steven Feuerstein

  • Search


  • QR Code Gimmick

    QR Code for Setting the Timestamp on UNIX files

WorkflowFAQ is proudly powered by WordPress | Copyright © 2008 TS Fifteen Ltd. All rights reserved.