2

If the use the following scp command then I get an error:

scp -P 22 username@xxx.xxx.xxx.xxx: /home/username/public_html/* ./

The error I get is:

stdin: is not a tty scp: .: not a regular file

What am I doing wrong?

Thanks for help.

April
  • 315
  • 7
  • 16

3 Answers3

3

If you want to copy everything under public_html, this would be correct way to do it:

scp -r -P 22 username@xxx.xxx.xxx.xxx:/home/username/public_html .

-r recurses through the subdirectories.

1

You don't need the space after the IP address of the remote machine:

scp -P 22 username@xxx.xxx.xxx.xxx:/home/username/public_html/* ./
Prof. Moriarty
  • 870
  • 8
  • 12
  • Just to calrify, I only want to copy everything in public_html folder including all sub-directories and files.

    Is this the right command for it?

    – April Apr 03 '10 at 12:07
  • I am getting the error "stdin: is not a tty" and then it copies some files from public_html folder and then stops.It does not copy any sub-folders.

    What am I doing wrong?

    – April Apr 03 '10 at 12:28
1

Think of scp the same way you think of cp. cp can't copy directions unless you specify some recursion for it to grab every folder and file within the said folder. If you want to copy a folder, you'd run cp -r folder/ destination/. scp is the same. You'll need to run scp -r user@host:/path/to/folder destination/

As a note, when using the default port for SSH (22) you don't need to specify it in the scp command.