How do I copy symbolic links only (and not the file it points to) or other files using rsync?
I tried
rsync -uvrl input_dir output_dir
but I need to exclusively copy the symbolic links only ?
any trick using include exclude options?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Per this question+answer, you can script this as a pipe. Pipes are an integral part of shell programming and shell scripting.
What’s going on here?
The
findcommand starts at /path/to/files and steps recursively through everything “under” that point. The options tofindare conditions that limit what gets output by the-printoption. In this case, only things of-type l(symbolic link, according toman find) will be printed to find’s “standard output”.These files become the “standard input” of the
rsynccommand’s--file-fromoption.Give it a shot. I haven’t actually tested this, but it seems to me that it should work.