Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
  1. In a previous post, I asked a question about simply right-click copy and paste in Nautilus sometimes cannot handle files with special characters in their names under Ubuntu.

    Later I found that scp seems to be able to solve this problem. Perhaps cp also can, but I haven't been able to tried yet.

    So I was wondering in what situations scp and cp will fail to copy files/directories?

  2. If I want to copy all contents under directory "source" to be under another one "destination", my command will be:

    scp -r source/* user@server:destination

    I was wondering if I want to copy just some not all subdiretories/files, i.e. excluding other subdirectories and files, under "source" to be under "destination", how to write a command?


share|improve this question
If you have really complex copy/move needs, you may want to strongly consider looking at rsync instead of scp. It is far more flexible and usable in differing use-cases. – Zoredache Feb 12 '11 at 22:04

As per the scp man pages:

scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] -S program] [[user@]host1:]file1 [...] [[user@]host2:]file2

You can keep specifying files at the end there.

share|improve this answer

I'd use find to get all files in the current directory and lower:

find . > list_of_files

Then edit that list_of_files file to just include what you want to copy. Then scp them:

for i in `cat list_of_files` ; do scp $i user@server:dest ; done
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.