How to filter files when using scp to copy dir recursively?

前端 未结 9 1263
醉酒成梦
醉酒成梦 2021-01-29 20:00

I need to copy all the .class files from server to local with all dir reserved. e.g. server:/usr/some/unknown/number/of/sub/folders/me.class will be /usr/proj

9条回答
  •  -上瘾入骨i
    2021-01-29 20:22

    To exclude dotfiles in base directory:

    scp -r [!.]* server:/path/to/something
    

    [!.]* is a shell glob that expands to all files in working directory not starting with a dot.

提交回复
热议问题