Is it possible to make SCP ignore symbolic links during copy?

I knew that it was possible, I just took wrong tool. I did it with rsync

rsync --progress -avhe ssh /usr/local/  XXX.XXX.XXX.XXX:/BackUp/usr/local/

I found that the rsync method did not work for me, however I found an alternative that did work on this website (www.docstore.mik.ua/orelly).

Specifically section 7.5.3 of "O'Reilly: SSH: The Secure Shell. The Definitive Guide".

7.5.3. Recursive Copy of Directories

...

Although scp can copy directories, it isn't necessarily the best method. If your directory contains hard links or soft links, they won't be duplicated. Links are copied as plain files (the link targets), and worse, circular directory links cause scp1 to loop indefinitely. (scp2 detects symbolic links and copies their targets instead.) Other types of special files, such as named pipes, also aren't copied correctly.A better solution is to use tar, which handles special files correctly, and send it to the remote machine to be untarred, via SSH:

$ tar cf - /usr/local/bin | ssh server.example.com tar xf -

Tags:

Scp