Skip to content
Advertisement

How to copy directory from remote server with scp, excluding a specific subdirectory

I have a directory that I want to copy from a remote server to my desktop. In this directory there is a 40Gb subdirectory that I want to exclude from copying. Until now I used the scp command but there is no -exclude option or anything similar in the man page. By looking online I found a bunch of different ways to copy directory from remote host or exclude a subdirectory when copying locally but no way of how to combine those two. Any help is appreciated. Thanks.

Advertisement

Answer

To copy with excluding some file or folder, you should try rsync command.

There is –exclude-dir option you can use to exclude subdirectory.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement