1844125 Members
2732 Online
110227 Solutions
New Discussion

rcp Files containing ":"

 
SOLVED
Go to solution
Christian Schulze
Regular Advisor

rcp Files containing ":"

I have Problems to rcp Files containing the special Character ":".

My Database creates compressed Backup-copies of the controlfiles every hour. The filename looks like control.ctl-18.08.04-11:02:01.Z

My problem is when I try to rcp this file, rcp recognizes the part before the : as a hostname and thus fails.

I tried some variants, but these didnt't work either

I use rcp create copies of the (important) controlfiles an archivelogs on another System.

never touch a running system
7 REPLIES 7
Sanjay Kumar Suri
Honored Contributor

Re: rcp Files containing ":"

Have you tried putting the files inside single or double quotes?

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Massimo Bianchi
Honored Contributor

Re: rcp Files containing ":"

Hi,
try to use double quotes:

rcp "control.ctl-18.08.04-11:02:01.Z" ...



extract from "man rcp"

Shell metacharacters in
remote paths can be quoted with backslash (\), single quotes (''), or
double quotes (""), so that they will be interpreted remotely.

HTH,
Massimo
Christian Schulze
Regular Advisor

Re: rcp Files containing ":"

no, double quotes and single quotes don't work either

rcp "control.ctl-18.08.04-11:02:01.Z" target:/archivelogs

rcp 'control.ctl-18.08.04-11:02:01.Z' target:/archivelogs

rcp control.ctl-18.08.04-11\:02\:01.Z target:/archivelogs

all of them give an error:
rcmd: control.ct-18.08.04-11: Unknown host

It looks as if rcp doesn't know about quoting the filename

Christian
never touch a running system
Massimo Bianchi
Honored Contributor

Re: rcp Files containing ":"

try

rcp "control.ctl-18.08.04-11:02:01.Z" target:/archivelogs/"control.ctl-18.08.04-11:02:01.Z"

because the command extend your input and substitute the missing file name.

Or, if you can afford different names:

NEWNAME=$( echo $OLDNAME | tr ":" "_" )

rcp $OLDNAME target:/dest/$NEWNAME


HTH,
Massimo
Sanjay Kumar Suri
Honored Contributor
Solution

Re: rcp Files containing ":"

Can you give the host name also in the rcp command as below?

rcp host1:/ora0/file1.txt host2:/ora0/temp/file1.txt

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Christian Schulze
Regular Advisor

Re: rcp Files containing ":"

Sorry Massimo, your idea doesn't work either ...

Bingo, Sanyay is right

rcp source:/logdir/"control.ctl-18.08.04-11:02:01.Z" target:/archivelogs/"control.ctl-18.08.04-11:02:01.Z"
works

Thanks guys

I was already thinking of a workaround with tar pipe and remsh ...


Christian
never touch a running system
Bharat Katkar
Honored Contributor

Re: rcp Files containing ":"

Hi,
As sanjay has already pointed out about servername, this works perfectly fine for me.

# rcp servername:/control.ctl-18.08.04-11:02:01.Z .

Regards,
You need to know a lot to actually know how little you know