Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using PSCP to upload some files from windows to linux. I can do it fine just uploading one file at a time. But I have some very large directories and I want to upload an entire dir at once.

I have tried:

pscp -i C:\sitedeploy\abt-keypair.ppk includes\* root@mysite.com:/usr/local/tomcat/webapps/ROOT/includes/*

Throws error: "pscp: remote filespec /usr/local/tomcat/webapps/ROOT/includes/*: not a directory"

and

pscp -i C:\sitedeploy\abt-keypair.ppk includes\ root@mysite.com:/usr/local/tomcat/webapps/ROOT/includes/

Throws error: "scp: includes\: not a regular file"

and

pscp -i C:\sitedeploy\abt-keypair.ppk includes root@mysite.com:/usr/local/tomcat/webapps/ROOT/includes

Throws error: "scp: includes\: not a regular file"

Thanks in advance!

share|improve this question
1  
Did you try adding -r? –  Pablo Castellazzi Jul 29 '11 at 16:21

3 Answers 3

up vote 8 down vote accepted

Two problems: First, the * does not go on the destination side. Second, -r is for copying an entire directory and subdirectories.

pscp -i C:\sitedeploy\abt-keypair.ppk includes\* root@mysite.com:/usr/local/tomcat/webapps/ROOT/includes/

Will copy all of the files in the local includes\ directory to the .../includes/ directory on the server.

pscp -r -i C:\sitedeploy\abt-keypair.ppk includes\ root@mysite.com:/usr/local/tomcat/webapps/ROOT/

Will copy the includes\ directory itself, including all files and subdirectories, to the .../ROOT/ directory on the server (where the contents of the local directory would merge with any existing .../ROOT/includes/ directory.

share|improve this answer

If you want to copy a directory and it's contents you don't need to provide a filespec for the destination just use the directory name e.g.

pscp  -i C:\sitedeploy\abt-keypair.ppk includes\* root@mysite.com:/usr/local/tomcat/webapps/ROOT/includes/

if you want to copy the directory and everything below it then you can use -r

pscp -r -i C:\sitedeploy\abt-keypair.ppk includes\ root@mysite.com:/usr/local/tomcat/webapps/ROOT/includes/
share|improve this answer

Disclaimer:

You dont need to use "-i" for this.It's for private key file authentication. Just use "-r" to copy the source files recursively.

You might want a drag and drop method since you're using Windows. Just use WINSCP client

share|improve this answer

Your Answer

 
discard

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.