LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-09-2004, 06:14 PM   #1
the_rhino
Member
 
Registered: Sep 2004
Distribution: PCLinuxOS
Posts: 59

Rep: Reputation: 15
scp directories ?


Can directories and the contents in them including sub-directories be copied with scp ? or, Do I need to make the directory and then use scp?

I would just use ftp but my experience with doing ftp from a linux box is painfully slow and scp is lightening fast.

Thanks
 
Old 10-09-2004, 06:21 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
man scp
/-r


Cheers,
Tink
 
Old 10-09-2004, 06:43 PM   #3
the_rhino
Member
 
Registered: Sep 2004
Distribution: PCLinuxOS
Posts: 59

Original Poster
Rep: Reputation: 15
Thanks for responding.

I have read man scp several times and had a difficult time figuring out the syntax before I was able to just copy one file or a lot of them with -r

I tried your /-r and it does not work.

-r copies the contents. I want to know if the directory *and* the contents can be copied in the same command step.

You either missed what I was asking or I do not understand your answer.
 
Old 10-09-2004, 07:23 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 235Reputation: 235Reputation: 235
Say I wanted to copy directory called XYZ in my home directory from host A to my other host B and place in my home directory.

Example:

cd ~
scp -r XYZ/ username@hostB:/home/username/

Its that simple.
 
Old 10-09-2004, 07:44 PM   #5
the_rhino
Member
 
Registered: Sep 2004
Distribution: PCLinuxOS
Posts: 59

Original Poster
Rep: Reputation: 15
Thanks, I figured it out just before getting your post.
 
Old 10-09-2004, 08:11 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally posted by the_rhino
I tried your /-r and it does not work.
Which program did you try it with?
try in
man scp


Cheers,
Tink
 
Old 09-28-2012, 11:42 AM   #7
Shumakriss
LQ Newbie
 
Registered: Sep 2012
Posts: 1

Rep: Reputation: Disabled
Summary

To summarize the solution:

Copy directories remotely with SCP in this way

Code:
scp -r user1@ip:source_directory user2@ip:destination_directory
This will copy the folder 'destination_directory' INTO the folder 'source_directory'

To clarify the previous posts:

Code:
man scp
shows you the manual page for scp. while reading a man page, typing '/' followed by text will search (ie '/-r' searches for the -r option in the man page)
 
Old 09-28-2012, 11:52 AM   #8
the_rhino
Member
 
Registered: Sep 2004
Distribution: PCLinuxOS
Posts: 59

Original Poster
Rep: Reputation: 15
I asked that question 10-9-2004
 
Old 09-28-2012, 11:55 AM   #9
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 425
Blog Entries: 28

Rep: Reputation: 2
no wonder it has 20000+ views.
 
Old 10-03-2012, 12:56 PM   #10
dominion7
LQ Newbie
 
Registered: Jul 2012
Location: Franklin, IN
Distribution: RHEL 5
Posts: 3

Rep: Reputation: Disabled
Hmmm..

I have always just cd to the dir I want to put the data in, then
ran scp -r username@servername:/sourcedir/data data
 
Old 10-03-2012, 01:04 PM   #11
the_rhino
Member
 
Registered: Sep 2004
Distribution: PCLinuxOS
Posts: 59

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by dominion7 View Post
I have always just cd to the dir I want to put the data in, then
ran scp -r username@servername:/sourcedir/data data
What is up with the sudden interest in my question from 8 years ago?
 
Old 10-03-2012, 01:12 PM   #12
dominion7
LQ Newbie
 
Registered: Jul 2012
Location: Franklin, IN
Distribution: RHEL 5
Posts: 3

Rep: Reputation: Disabled
HAHAHAHA.... I was in the middle of migrating a bunch of junk and was asked what I used. We came across this post at looking at others alternatives... pretty funny though..
 
Old 10-03-2012, 02:51 PM   #13
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,528

Rep: Reputation: 2108Reputation: 2108Reputation: 2108Reputation: 2108Reputation: 2108Reputation: 2108Reputation: 2108Reputation: 2108Reputation: 2108Reputation: 2108Reputation: 2108
Quote:
Originally Posted by Shumakriss View Post
To summarize the solution:

Copy directories remotely with SCP in this way

Code:
scp -r user1@ip:source_directory user2@ip:destination_directory
This will copy the folder 'destination_directory' INTO the folder 'source_directory'
Why bump an 8 year old post that has been clearly solved with information that isn't even correct?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scp does not work and gives the following error message: scp: FATAL: Executing ssh1 i akay Linux - Networking 16 09-28-2008 11:41 PM
CHMOD directories.sub-directories.files zerojosh Linux - Software 2 11-19-2005 03:22 PM
Searching multiple directories and sub directories for a file jeep99899 Linux - Newbie 2 10-13-2005 12:23 PM
useing SCP to copy entire directories with sub folders? Lleb_KCir Linux - General 5 09-13-2005 09:08 PM
What is SCP? radam Linux - Software 2 07-20-2004 07:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration