scp multiple files without pattern on Solaris


 
Thread Tools Search this Thread
Operating Systems Solaris scp multiple files without pattern on Solaris
# 1  
Old 01-18-2016
scp multiple files without pattern on Solaris

I need to transfer multiple files using scp between two solaris machines. I could not use pattern since they match with other files in the same directory.

I tried the below command, it does not copy any files.

Code:
$ scp -p user@machine1:/home/fid1/staging/\{a.ksh,b.ksh,c.ksh,d.ksh\} .

But this works.

Code:
$ scp -p user@machine1:/home/fid1/staging/a.ksh .

Could someone please explain?
# 2  
Old 01-18-2016
Hi,
I think your solaris shell (sh) does not support syntax '{file1,file2,file3,...}'
Have you try with verbose option (-v) ?

Regards.
# 3  
Old 01-19-2016
Can you copy another way around with list file

For instance :
Code:
cd <directory with files and list file> # or list file with absolute paths from anywhere.
scp $(cat list) user@remoteserver:/path/

Or create a regular expression which will match the files need from the first example [abcd].ksh
Also, you might want to use more modern shell such as ksh.

Hope that helps
Regards
Peasant.
# 4  
Old 01-19-2016
I tried with (-v) option

Code:
19/01/2016 16:14:25:741 SftpAppLibSft/secsh_sft.c:3860/ssh_sft_get_conn_params: Connection id: #4, Destination: user@machine#22, Protocol version: secsh2, Cipher spec: aes128-cbc+hmac-sha1, Auth method: keyboard-interactive, Compression: none, Exclusive: yes
19/01/2016 16:14:26:696 SftpAppLibSft/secsh_sft.c:4179/ssh_sft_open_internal: Server SFT protocol version is 3.
19/01/2016 16:14:26:725 SftpAppLibSft/secsh_sft.c:3623/ssh_sft_server_type_probe: Server system type is POSIX.
19/01/2016 16:14:26:819 SftpAppLibSft/secsh_sft.c:3731/ssh_sft_server_streaming_probe_magic: Server supports EXTENDED streaming.
19/01/2016 16:14:27:081 SftpScpG3/scpg3.c:186/scp_exit: Exit code: 6

@Peasant: I could not do the other way since only functional ID(FID) has access to write to the folder, which I could not become from the remote server.
# 5  
Old 01-19-2016
Another example -
On the local machine:
Code:
ssh -e none  user@remoteserver 'tar cf - a.ksh b.ksh c.ksh' | (  tar xf -)

# 6  
Old 01-20-2016
Hi,
Can you try like this (without '\' ):
Code:
scp -p user@machine1:/home/fid1/staging/{a.ksh,b.ksh,c.ksh,d.ksh} .

Here, translation is doing by local machine...
Syntaxe not simplified:
Code:
scp -p user@machine1:/home/fid1/staging/a.ksh user@machine1:/home/fid1/staging/b.ksh user@machine1:/home/fid1/staging/c.ksh user@machine1:/home/fid1/staging/d.ksh .

Regards.

---------- Post updated at 02:52 PM ---------- Previous update was at 12:06 PM ----------

If you have /bin/bash on your remote machine, you have this trick:
Code:
scp -p user@machine1:\`/bin/bash\ -c\ "echo\ /home/fid1/staging/{a.ksh,b.ksh,c.ksh,d.ksh}"\` .

Regards.
# 7  
Old 01-20-2016
Quote:
Originally Posted by jim mcnamara
Another example -
On the local machine:
Code:
ssh -e none  user@remoteserver 'tar cf - a.ksh b.ksh c.ksh' | (  tar xf -)

Will this preserve time stamp?

---------- Post updated at 12:59 PM ---------- Previous update was at 12:39 PM ----------

Quote:
Originally Posted by disedorgue
Hi,
Can you try like this (without '\' ):
Code:
scp -p user@machine1:/home/fid1/staging/{a.ksh,b.ksh,c.ksh,d.ksh} .

Here, translation is doing by local machine...
Syntaxe not simplified:
Code:
scp -p user@machine1:/home/fid1/staging/a.ksh user@machine1:/home/fid1/staging/b.ksh user@machine1:/home/fid1/staging/c.ksh user@machine1:/home/fid1/staging/d.ksh .

Regards.

---------- Post updated at 02:52 PM ---------- Previous update was at 12:06 PM ----------

If you have /bin/bash on your remote machine, you have this trick:
Code:
scp -p user@machine1:\`/bin/bash\ -c\ "echo\ /home/fid1/staging/{a.ksh,b.ksh,c.ksh,d.ksh}"\` .

Regards.
First option did not work.
Second option works, as expected.
Third option did not work.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pattern search multiple files

#!/usr/bin/ksh a="Run successfully" cd $APPS ls -l *.txt | while read $txt do if then cp $APPS/$txt cp $hist/$txt else rm $APPS/$txt echo "Files has been removed" fi done New in shell script please help me out Around 100 txt files in $APPS dir i want to search pattern from... (8 Replies)
Discussion started by: Kalia
8 Replies

2. UNIX for Beginners Questions & Answers

scp of multiple files to remote server

Hello, I would like to scp multiple files to a remote server that requires a password for the process to be completed. I have 30 folders (x_1, x_2 ... x_30), each containing 25 files. What I want to do is scp 1 out of the 25 files (file called bvals) for all my folders to a remote server and... (3 Replies)
Discussion started by: nasia.m
3 Replies

3. UNIX for Advanced & Expert Users

Concatenation of multiple files based on file pattern

Hi, I have the following reports that get generated every 1 hour and this is my requirement: 1. 5 reports get generated every hour with the names "Report.Dddmmyy.Thhmiss.CTLR" "Report.Dddmmyy.Thhmiss.ACCD" "Report.Dddmmyy.Thhmiss.BCCD" "Report.Dddmmyy.Thhmiss.CCCD"... (1 Reply)
Discussion started by: Jesshelle David
1 Replies

4. Shell Programming and Scripting

Creating single pattern for matching multiple files.

Hi friends, I have a some files in a directory. for example 856-abc 856-def 851-abc 945-def 956-abc 852-abc i want to display only those files whose name starts with 856* 945* and 851* using a single pattern. i.e 856-abc 856-def 851-abc 945-def the rest of the two files... (2 Replies)
Discussion started by: Little
2 Replies

5. Shell Programming and Scripting

scp or rsync multiple files in parallel from a remote host

Hi. I'm trying to speed up an rsync command by running it in parallel. There's no real option for this other than if the files are in multiple directories (which they're not). And even then there's no way of knowing if rsync has succeeded as the process is running in the background .. and... (4 Replies)
Discussion started by: Big_Jeffrey
4 Replies

6. UNIX for Advanced & Expert Users

Moving multiple files based on the pattern

I want to search for a particular file name patterns and move them to a specific folder, is it possible to do it with awk or sed? (1 Reply)
Discussion started by: rudoraj
1 Replies

7. UNIX for Dummies Questions & Answers

scp multiple files

Hi, I'm new to Linux. I would like to know how to scp a group of files. I have the below command, but it asks for remote password while sending each file. Is there a way to send all files (identified by - $ ls | grep '.*hrs0314a.*' | xargs -I {} grep -l '.*35663.*' {}) in one go? $ ls |... (6 Replies)
Discussion started by: don_tom
6 Replies

8. Shell Programming and Scripting

Searching across multiple files if pattern is available in all files searched

I have a list of pattern in a file, I want each of these pattern been searched from 4 files. I was wondering this can be done in SED / AWK. say my 4 files to be searched are > cat f1 abc/x(12) 1 abc/x 3 cde 2 zzz 3 fdf 4 > cat f2 fdf 4 cde 3 abc 2... (6 Replies)
Discussion started by: novice_man
6 Replies

9. Shell Programming and Scripting

pattern search for multiple log files and counting

I have 10 appservers and each appserver has 4 jvms . Each of these logs is archived and stored on a nfs directory . For example the files are /logs/200907/ap1-jvm1.server.log.20090715.gz /logs/200907/ap2-jvm2.server.log.20090714.gz /logs/200908/ap1-jvm1.server.log.20090812.gz I want to... (3 Replies)
Discussion started by: gubbu
3 Replies

10. Shell Programming and Scripting

SCP multiple files

Hi , I am doing SCP for copying log files from different server(around 24 server) I need to copy these bulk logfiles every 15 min. How can i do multiple SCP at the same time? My current code is like this scp $CUSTCARE_USER@$CUSTCARE_SERVER:$CUSTCARE_HOME/$CUSTCARE_LOG.*... (2 Replies)
Discussion started by: scorpio
2 Replies
Login or Register to Ask a Question