Sponsored Content
Full Discussion: Change a file's timestamp
Operating Systems AIX Change a file's timestamp Post 302194431 by shibajighosh on Tuesday 13th of May 2008 12:16:21 AM
Old 05-13-2008
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.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Timestamp of File permission change

Hi!! Experts, Is there any way to find the timestamp when the permission of a file was modified?? I mean no change to file contents.. Just the chnage of permissions. :) (1 Reply)
Discussion started by: jyotipg
1 Replies

2. HP-UX

change timestamp of file

Hi, How I change the timestamp of file to some past date Let's say I have this file -rw-r--r-- 1 oracle dba 16587 Apr 11 10:46 create_dev.sql And I want to change the timestamp to Mar 10th 7:45 PM So it should appear like this: -rw-r--r-- 1 oracle dba ... (1 Reply)
Discussion started by: isingh786
1 Replies

3. UNIX for Dummies Questions & Answers

move file change timestamp

Hello, Alright solution: I need to move files to a backup folder, changing the datestamp to the current day so that the file stays in the backup folder for the full 30 days before another script removes it. Obviously, any file I move in will preserve the timestamp which is what I *don't* want.... (2 Replies)
Discussion started by: tekster757
2 Replies

4. Shell Programming and Scripting

Change File Header Timestamp

Please I am new to Unix and this simple question I am already answered but struggling to find the answer. I have a data file which contains header record which conatins date timestamp. I need to find a way of simply updating the date time stamp to current date timestamp. So if the header... (5 Replies)
Discussion started by: mudi
5 Replies

5. AIX

Change specific (not current) date to timestamp

Hello to all. I work at AIX system without perl installed and I am restricted user, so I am limited to bash. In script that I am writing, I have to read line from file and transform date that I found inside to Unix timestamp. Line in file look something like this: Tue Mar 29 06:59:00... (5 Replies)
Discussion started by: Hyperborejac
5 Replies

6. Shell Programming and Scripting

Getting a relative timestamp from timestamp stored in a file

Hi, I've a file in the following format 1999-APR-8 17:31:06 1500 3 45 1999-APR-8 17:31:15 1500 3 45 1999-APR-8 17:31:25 1500 3 45 1999-APR-8 17:31:30 1500 3 45 1999-APR-8 17:31:55 1500 3 45 1999-APR-8 17:32:06 1500 3 ... (1 Reply)
Discussion started by: vaibhavkorde
1 Replies

7. Red Hat

Can not change timestamp on directory inside cifs mount

Greetings, I have an rsync server that is unable to change the timestamp on any directories inside of cifs mounts. The same thing happens on all of my red hat machines. These machines are all patched, touch -t works on directories inside any other filesystem including NFS mounts. This is... (0 Replies)
Discussion started by: Create
0 Replies

8. UNIX for Dummies Questions & Answers

How to compare a file by its timestamp and store in a different location whenever timestamp changes?

Hi All, I am new to unix programming. I am trying for a requirement and the requirement goes like this..... I have a test folder. Which tracks log files. After certain time, the log file is getting overwritten by another file (randomly as the time interval is not periodic). I need to preserve... (2 Replies)
Discussion started by: mailsara
2 Replies

9. Shell Programming and Scripting

Timestamp change for hard and soft links

Hi team, i am writing a purge script to delete softlinks and hardlinks on linux system which are 3/10/30 days old. To test the script i need to create links with old timestamp, i am able to cange timestamp for files but not for links. i tried touch -h option but this option is not available on... (1 Reply)
Discussion started by: Satyak
1 Replies

10. Shell Programming and Scripting

To check timestamp in logfile and display lines upto 3 hours before current timestamp

Hi Friends, I have the following logfile. Currently time in india is 07/31/2014 12:33:34 and i have the following content in logfile. I want to display only those entries which contain string 'Exception' within last 3 hours. In this case, it would be the last line only I can get the... (12 Replies)
Discussion started by: srkmish
12 Replies
SD_JOURNAL_GET_REALTIME_USEC(3) 			   sd_journal_get_realtime_usec 			   SD_JOURNAL_GET_REALTIME_USEC(3)

NAME
sd_journal_get_realtime_usec, sd_journal_get_monotonic_usec - Read timestamps from the current journal entry SYNOPSIS
#include <systemd/sd-journal.h> int sd_journal_get_realtime_usec(sd_journal* j, uint64_t* usec); int sd_journal_get_monotonic_usec(sd_journal* j, uint64_t* usec, sd_id128_t* boot_id); DESCRIPTION
sd_journal_get_realtime_usec() gets the realtime (wallclock) timestamp of the current journal entry. It takes two arguments: the journal context object and a pointer to a 64-bit unsigned integer to store the timestamp in. The timestamp is in microseconds since the epoch, i.e. CLOCK_REALTIME. sd_journal_get_monotonic_usec() gets the monotonic timestamp of the current journal entry. It takes three arguments: the journal context object, a pointer to a 64-bit unsigned integer to store the timestamp in, as well as a 128-bit ID buffer to store the boot ID of the monotonic timestamp. The timestamp is in microseconds since boot-up of the specific boot, i.e. CLOCK_MONOTONIC. Since the monotonic clock begins new with every reboot, it only defines a well-defined point in time when used together with an identifier identifying the boot. See sd_id128_get_boot(3) for more information. If the boot ID parameter is passed NULL, the function will fail if the monotonic timestamp of the current entry is not of the current system boot. Note that these functions will not work before sd_journal_next(3) (or related call) has been called at least once, in order to position the read pointer at a valid entry. RETURN VALUE
sd_journal_get_realtime_usec() and sd_journal_get_monotonic_usec() returns 0 on success or a negative errno-style error code. If the boot ID parameter was passed NULL and the monotonic timestamp of the current journal entry is not of the current system boot, -ESTALE is returned by sd_journal_get_monotonic_usec(). NOTES
The sd_journal_get_realtime_usec() and sd_journal_get_monotonic_usec() interfaces are available as a shared library, which can be compiled and linked to with the libsystemd-journal pkg-config(1) file. SEE ALSO
systemd(1), sd-journal(3), sd_journal_open(3), sd_journal_next(3), sd_journal_get_data(3), sd_id128_get_boot(3), clock_gettime(2), sd_journal_get_cutoff_realtime_usec(3) systemd 208 SD_JOURNAL_GET_REALTIME_USEC(3)
All times are GMT -4. The time now is 12:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy