Sponsored Content
Top Forums Shell Programming and Scripting modify actime and modtime of symbolic links Post 302171196 by avanigadhai on Thursday 28th of February 2008 01:13:39 AM
Old 02-28-2008
modify actime and modtime of symbolic links

Hi,

I am trying to duplicate a symbolic link, the new link should be the exact replica of the original one, with same file attributes, permissions, owner, group and even the time.

i m successful in changing the owner and group, but when i try to change the time using utime, the time of the file which is pointed to by this link get updated.

for example, there is file1 and file1_link is a symbolic link to file1. something like this:

lrwxrwxrwx 1 avni avni 5 Feb 27 11:44 file1_link -> file1
-rw-rw-rw- 1 avni avni 2061 Feb 26 18:47 file1

now i have to duplicate file1_link so that i have

lrwxrwxrwx 1 avni avni 5 Feb 27 11:44 file1_link_dup -> file1

but instead i get
lrwxrwxrwx 1 avni avni 5 Feb 28 11:30 file1_link_dup -> file1

when is do utime for file1_link_dup the result is something like this:
lrwxrwxrwx 1 avni avni 5 Feb 27 11:44 file1_link -> file1
-rw-rw-rw- 1 avni avni 2061 Feb 27 11:44 file1
lrwxrwxrwx 1 avni avni 5 Feb 28 11:30 file1_link_dup -> file1

can any body tell how this can be achieved.
I read about lutimes, but its not on my system.

i am writing code in C. I cannot use perl.

I am new to UNIX and hence have little knowledge of the various distributions and commands available.

Can any onw guide on where i should start the search for the solution!!!

Thanks in advance.
Edit/Delete Message
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Finding symbolic links

How can I find all symbolic links across the network to a directory (2 Replies)
Discussion started by: mehtad
2 Replies

2. UNIX for Dummies Questions & Answers

Too many levels of symbolic links

Hi, Is there a limit to the number of symbolic links you can have? I tried to vi the symbolic link relating to a file and got the following error: "filename" Too many levels of symbolic links There is only one symbolic link to one file in this case, but there are >2000 other links to... (2 Replies)
Discussion started by: Bab00shka
2 Replies

3. Solaris

cp a dty without symbolic links?

Hi, - we have copy (cp command) to do to save all the contents of a dty BUT we dont want to copy the files corresponding to symbolic links contained whithin this dty - the box is a sun solaris one - and the cp commande do not say avything about that? thanks for help Jakez (7 Replies)
Discussion started by: JAKEZ
7 Replies

4. AIX

Symbolic Links

I am linking a directory as follows: ln -sf /home/xxx/userid/real_files/* /home/xxx/userid/linked_files This gives me symbolic links for all the files in the real_files directory in the linked_files directory. My question is, if I go and remove a file in the real_files directory and then go... (1 Reply)
Discussion started by: rcarnesiii
1 Replies

5. UNIX for Dummies Questions & Answers

Symbolic links between directories

Hi all, lets consider 2 directories test1 and test2. I want to link test2 to point to test1, how do u do this? (4 Replies)
Discussion started by: Mr. Zer0
4 Replies

6. Solaris

symbolic links between servers

Hi Guys... I want to create a link using ln -s for a directory that does not exist on the box. How do I do that? I had some files from Box A directory /d1/u01 and I copied the files across to another Box lets say Box B on directory /d2/u02. Now I want a link so that this path /d1/u01... (2 Replies)
Discussion started by: Phuti
2 Replies

7. UNIX for Dummies Questions & Answers

Symbolic Links

Hi all, I have scoured the entire forum for this but to no avail unfortunately. Basically, I would like to remove my symbolic link from my folder name i.e. foldername -> /a/b/c/d/f where f is indeed a folder. I have tried rmdir but this does not work and in actual fact deletes the... (4 Replies)
Discussion started by: cyberfrog
4 Replies

8. UNIX for Dummies Questions & Answers

Permissioning for symbolic links

I've just started using UNIX in a Linux vmplayer. I'm trying to run the command: ln -s `pwd`/$1 `python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"`/$1 in a script from an online tutorial, but I keep getting an error message: ln: creating symbolic link... (1 Reply)
Discussion started by: ChipT
1 Replies

9. UNIX for Dummies Questions & Answers

Symbolic links in UNIX

Hi, I have a file with more than 1 layers of soft links for it. For ex. ls -la .profile .profile@ -> /home/act/.profile_abc ls -la /home/act/.profile_abc@ -> .profile_final I want to get the name of the last file (i.e. .profile_final) when I refer to .profile using shell script. I... (2 Replies)
Discussion started by: deo_kaustubh
2 Replies

10. Solaris

Symbolic links

Soft link,Hard link brief explanation (1 Reply)
Discussion started by: RAJU KAVATI
1 Replies
CHOWN(8)						    BSD System Manager's Manual 						  CHOWN(8)

NAME
chown -- change file owner and group SYNOPSIS
chown [-fhvx] [-R [-H | -L | -P]] owner[:group] file ... chown [-fhvx] [-R [-H | -L | -P]] :group file ... DESCRIPTION
The chown utility changes the user ID and/or the group ID of the specified files. Symbolic links named by arguments are silently left unchanged unless -h is used. The options are as follows: -H If the -R option is specified, symbolic links on the command line are followed. (Symbolic links encountered in the tree traversal are not followed.) -L If the -R option is specified, all symbolic links are followed. -P If the -R option is specified, no symbolic links are followed. This is the default. -R Change the user ID and/or the group ID of the specified directory trees (recursively, including their contents) and files. Beware of unintentionally matching the ``..'' hard link to the parent directory when using wildcards like ``.*''. -f Do not report any failure to change file owner or group, nor modify the exit status to reflect such failures. -h If the file is a symbolic link, change the user ID and/or the group ID of the link itself. -v Cause chown to be verbose, showing files as the owner is modified. If the -v flag is specified more than once, chown will print the filename, followed by the old and new numeric user/group ID. -x File system mount points are not traversed. The -H, -L and -P options are ignored unless the -R option is specified. In addition, these options override each other and the command's actions are determined by the last one specified. The owner and group operands are both optional, however, one must be specified. If the group operand is specified, it must be preceded by a colon (``:'') character. The owner may be either a numeric user ID or a user name. If a user name is also a numeric user ID, the operand is used as a user name. The group may be either a numeric group ID or a group name. If a group name is also a numeric group ID, the operand is used as a group name. The ownership of a file may only be altered by a super-user for obvious security reasons. EXIT STATUS
The chown utility exits 0 on success, and >0 if an error occurs. COMPATIBILITY
Previous versions of the chown utility used the dot (``.'') character to distinguish the group name. This has been changed to be a colon (``:'') character so that user and group names may contain the dot character. On previous versions of this system, symbolic links did not have owners. The -v and -x options are non-standard and their use in scripts is not recommended. SEE ALSO
chgrp(1), find(1), chown(2), fts(3), symlink(7) STANDARDS
The chown utility is expected to be IEEE Std 1003.2 (``POSIX.2'') compliant. HISTORY
A chown utility appeared in Version 1 AT&T UNIX. BSD
February 21, 2010 BSD
All times are GMT -4. The time now is 05:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy