LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   SCP how to (https://www.linuxquestions.org/questions/linux-newbie-8/scp-how-to-287639/)

the_rhino 02-08-2005 07:45 AM

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

Bruce Hill 02-08-2005 08:18 AM

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


overlord73 02-08-2005 08:26 AM

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

scp `cat filename` user@host:/home/~user

the_rhino 02-08-2005 09:08 AM

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?

overlord73 02-09-2005 12:59 AM

simply the filename.
Code:

$ cat filelist.txt
file1
file2
file3
file4


the_rhino 02-11-2005 07:50 PM

Thanks, I got it to work. I like it!


All times are GMT -5. The time now is 02:15 AM.