copy file from symlink

Ask questions about Arch Linux ARM. Please search before making a new topic.

copy file from symlink

Postby Socaltom » Sat Dec 22, 2012 9:00 pm

I'm trying to follow a symlink to copy a file. Everytime motion takes a picture it links the picture through a symlink named lastsnap.jpg. Unfortunatly I can't get lighttpd to display the picture ( yes I have follow symlinks turned on). So I thought I would try actually copying the last picture through the symlink. but cp ( -L) nor anything else I've found will actually copy the contents of the target of the link. How does one do this?
Thanks
Tom
used to be owned by me
Pink Pogo V2, Black Pogo V3, Zyxel NAS 325 v1,
used to be Adminstrator for
Goflex net, Black V3, Black V2
Now I have a couple of raspberry pi ( 3+ and 4)
Socaltom
 
Posts: 571
Joined: Thu Apr 07, 2011 2:21 pm
Location: The left side

Re: copy file from symlink

Postby karog » Sat Dec 22, 2012 10:32 pm

Here bar.txt is a symlink to foo.txt. And cp bar.txt rab.txt copies the target file. How does this fail for you? Are you using other switches that may be turning off dereference like -a or -d?
$this->bbcode_second_pass_code('', '
# ls -l
total 4
lrwxrwxrwx 1 root root 7 Dec 22 17:27 bar.txt -> foo.txt
-rw-r--r-- 1 root root 16 Dec 22 17:27 foo.txt
# cp bar.txt rab.txt
# ls -l
total 8
lrwxrwxrwx 1 root root 7 Dec 22 17:27 bar.txt -> foo.txt
-rw-r--r-- 1 root root 16 Dec 22 17:27 foo.txt
-rw-r--r-- 1 root root 16 Dec 22 17:27 rab.txt
')
karog
 
Posts: 305
Joined: Thu Jan 05, 2012 7:55 pm


Return to User Questions

Who is online

Users browsing this forum: No registered users and 4 guests