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 02-08-2005, 07:45 AM   #1
the_rhino
Member
 
Registered: Sep 2004
Distribution: PCLinuxOS
Posts: 59

Rep: Reputation: 15
SCP how to


Can one use SCP to copy just some of the files in a directory at one time or will they have to be copied one at a time.

Example: There are 12 files in a directory and only 4 of them need to be copied to a new location.

I understand how to copy one or even the entire directory.

Man scp and info scp does not help. Most of the time I can't figure out what man or info are saying about a command or what the options with the command mean. I learn by trial and error and asking a lot of questions.

Thanks
 
Old 02-08-2005, 08:18 AM   #2
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,939

Rep: Reputation: 129Reputation: 129
You could list the files separated by spaces,
like this:
Code:
mingdao@peter:~$ ls -alc
total 16486
drwx--x--x    4 mingdao  users         464 Feb  8 22:17 ./
drwxr-xr-x    6 root     root          120 Oct 24 09:26 ../
-rw-------    1 mingdao  users        2160 Feb  8 22:14 .bash_history
drwx------    2 mingdao  users         136 Jan 30 07:05 .gnupg/
-rw-r--r--    1 mingdao  users        3394 Oct 24 09:26 .screenrc
drwx------    2 mingdao  users          80 Oct 25 20:36 .ssh/
-rw-r--r--    1 mingdao  users       35042 Oct 25 20:35 Anna_testimony.sxw
-rw-r--r--    1 mingdao  users          36 Feb  8 22:17 file_tfr
-rw-------    1 mingdao  users     8468961 Feb  8 22:11 firefox-0.9.1-i686-linux-gtk2+xft-installer.tar.gz
-rw-------    1 mingdao  users     8344026 Feb  8 22:11 firefox-0.9.3-i686-linux-gtk2+xft-installer.tar.gz
-rw-r--r--    1 mingdao  users          62 Feb  8 22:11 firefox_error
-rw-r--r--    1 mingdao  users          38 Feb  8 22:11 flashwa.ram
-rw-r--r--    1 mingdao  users         121 Nov  3 10:10 good_commands
mingdao@peter:~$ scp file_tfr firefox_error good_commands flashwa.ram 192.168.1.31:~/test
mingdao@192.168.1.31's password: 
file_tfr                                                                                                                                100%   36     0.0KB/s   00:00    
firefox_error                                                                                                                           100%   62     0.0KB/s   00:00    
good_commands                                                                                                                           100%  121     0.0KB/s   00:00    
flashwa.ram                                                                                                                             100%   38     0.0KB/s   00:00    
mingdao@peter:~$logout
mingdao@james:~/test$ ls -alc ~/test
total 21
drwxr-xr-x   2 mingdao users  168 2005-02-08 22:16 ./
drwx--x--x  75 mingdao users 5144 2005-02-08 22:10 ../
-rw-r--r--   1 mingdao users   36 2005-02-08 22:15 file_tfr
-rw-r--r--   1 mingdao users   62 2005-02-08 22:15 firefox_error
-rw-r--r--   1 mingdao users   38 2005-02-08 22:15 flashwa.ram
-rw-r--r--   1 mingdao users  121 2005-02-08 22:15 good_commands
 
Old 02-08-2005, 08:26 AM   #3
overlord73
Member
 
Registered: Apr 2004
Location: ..where no life dwells..
Posts: 541

Rep: Reputation: 30
if you have a txtfile including the filenames of the files to be copied you can use:

scp `cat filename` user@host:/home/~user
 
Old 02-08-2005, 09:08 AM   #4
the_rhino
Member
 
Registered: Sep 2004
Distribution: PCLinuxOS
Posts: 59

Original Poster
Rep: Reputation: 15
I like the idea of a txt file with the names of the files listed if it works but I can't get it to work.

How does the contents of the txt file have to be written?
 
Old 02-09-2005, 12:59 AM   #5
overlord73
Member
 
Registered: Apr 2004
Location: ..where no life dwells..
Posts: 541

Rep: Reputation: 30
simply the filename.
Code:
$ cat filelist.txt
file1
file2
file3
file4
 
Old 02-11-2005, 07:50 PM   #6
the_rhino
Member
 
Registered: Sep 2004
Distribution: PCLinuxOS
Posts: 59

Original Poster
Rep: Reputation: 15
Thanks, I got it to work. I like it!
 
  


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 stalled Xitron Linux - Networking 3 03-25-2010 04:13 PM
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
What is SCP? radam Linux - Software 2 07-20-2004 07:07 PM
Win Scp scottpioso Linux - Software 3 12-05-2003 04:59 PM
Help with SCP lfindle Linux - Newbie 14 07-09-2002 02:08 PM

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

All times are GMT -5. The time now is 04:00 AM.

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
Open Source Consulting | Domain Registration