Sponsored Content
Full Discussion: Change a file's timestamp
Operating Systems AIX Change a file's timestamp Post 302199657 by rcarnesiii on Tuesday 27th of May 2008 11:51:51 AM
Old 05-27-2008
Sounds like someone is trying to do something fishy "file should appear as if it has not been modified" Smilie . Anyways, I have a question about the modification time for a symbolic link.
Code:
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

Last edited by rbatte1; 08-09-2016 at 05:07 AM.. Reason: Added CODE tags
 

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
LN(1)							    BSD General Commands Manual 						     LN(1)

NAME
ln, link -- link files SYNOPSIS
ln [-L | -P | -s [-F]] [-f | -iw] [-hnv] source_file [target_file] ln [-L | -P | -s [-F]] [-f | -iw] [-hnv] source_file ... target_dir link source_file target_file DESCRIPTION
The ln utility creates a new directory entry (linked file) for the file name specified by target_file. The target_file will be created with the same file modes as the source_file. It is useful for maintaining multiple copies of a file in many places at once without using up stor- age for the ``copies''; instead, a link ``points'' to the original copy. There are two types of links; hard links and symbolic links. How a link ``points'' to a file is one of the differences between a hard and symbolic link. The options are as follows: -F If the target file already exists and is a directory, then remove it so that the link may occur. The -F option should be used with either -f or -i options. If none is specified, -f is implied. The -F option is a no-op unless -s option is specified. -L When creating a hard link to a symbolic link, create a hard link to the target of the symbolic link. This is the default. This option cancels the -P option. -P When creating a hard link to a symbolic link, create a hard link to the symbolic link itself. This option cancels the -L option. -f If the target file already exists, then unlink it so that the link may occur. (The -f option overrides any previous -i and -w options.) -h If the target_file or target_dir is a symbolic link, do not follow it. This is most useful with the -f option, to replace a symlink which may point to a directory. -i Cause ln to write a prompt to standard error if the target file exists. If the response from the standard input begins with the char- acter 'y' or 'Y', then unlink the target file so that the link may occur. Otherwise, do not attempt the link. (The -i option over- rides any previous -f options.) -n Same as -h, for compatibility with other ln implementations. -s Create a symbolic link. -v Cause ln to be verbose, showing files as they are processed. -w Warn if the source of a symbolic link does not currently exist. By default, ln makes hard links. A hard link to a file is indistinguishable from the original directory entry; any changes to a file are effectively independent of the name used to reference the file. Directories may not be hardlinked, and hard links may not span file systems. A symbolic link contains the name of the file to which it is linked. The referenced file is used when an open(2) operation is performed on the link. A stat(2) on a symbolic link will return the linked-to file; an lstat(2) must be done to obtain information about the link. The readlink(2) call may be used to read the contents of a symbolic link. Symbolic links may span file systems and may refer to directories. Given one or two arguments, ln creates a link to an existing file source_file. If target_file is given, the link has that name; target_file may also be a directory in which to place the link; otherwise it is placed in the current directory. If only the directory is specified, the link will be made to the last component of source_file. Given more than two arguments, ln makes links in target_dir to all the named source files. The links made will have the same name as the files being linked to. When the utility is called as link, exactly two arguments must be supplied, neither of which may specify a directory. No options may be sup- plied in this simple mode of operation, which performs a link(2) operation using the two passed arguments. EXAMPLES
Create a symbolic link named /home/src and point it to /usr/src: # ln -s /usr/src /home/src Hard link /usr/local/bin/fooprog to file /usr/local/bin/fooprog-1.0: # ln /usr/local/bin/fooprog-1.0 /usr/local/bin/fooprog As an exercise, try the following commands: # ls -i /bin/[ 11553 /bin/[ # ls -i /bin/test 11553 /bin/test Note that both files have the same inode; that is, /bin/[ is essentially an alias for the test(1) command. This hard link exists so test(1) may be invoked from shell scripts, for example, using the if [ ] construct. In the next example, the second call to ln removes the original foo and creates a replacement pointing to baz: # mkdir bar baz # ln -s bar foo # ln -shf baz foo Without the -h option, this would instead leave foo pointing to bar and inside foo create a new symlink baz pointing to itself. This results from directory-walking. An easy rule to remember is that the argument order for ln is the same as for cp(1): The first argument needs to exist, the second one is created. COMPATIBILITY
The -h, -i, -n, -v and -w options are non-standard and their use in scripts is not recommended. They are provided solely for compatibility with other ln implementations. The -F option is a FreeBSD extension and should not be used in portable scripts. SEE ALSO
link(2), lstat(2), readlink(2), stat(2), symlink(2), symlink(7) STANDARDS
The ln utility conforms to IEEE Std 1003.2-1992 (``POSIX.2''). The simplified link command conforms to Version 2 of the Single UNIX Specification (``SUSv2''). HISTORY
An ln command appeared in Version 1 AT&T UNIX. BSD
November 2, 2012 BSD
All times are GMT -4. The time now is 06:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy