I want to scp a file to a server. The file is a symbolic link, and actually I want to do is copying the source file. Anyway I don't want to track source file's path manually, because it can be replaced. If I can get source file's absolute path, i can sep with it. How can I get the path?
|
Try this line:
If |
|||||
|
|
Stat will give you this information:
|
|||
|
|
|
Under Linux, This isn't necessary for scp though: scp always follows symlinks (it always copies file content, ignoring metadata except that If you find yourself disappointed by what metadata scp can and can't preserve, I suggest using rsync. With no option, rsync copies file contents ignoring metadata. The commonly used option |
|||
|
|
scpversions follow symlinks by default, don't they? You should check yours and maybe save yourself some work. – jw013 Oct 6 '11 at 3:26scp -rforces following symlinks. – Eonil Oct 6 '11 at 4:43