how scp a file to server with space in the directory name

Hello forum, I�m trying to get someone else�s log rotation & sync script working. The ksh script is sending daily compressed log files to a Windows RSA envision server. The name of the directory is
�CA SITEMINDER_<IP address of the sending server>�. The servers we are sending from are a mix of Solaris 8, 9 & 10. The server I�ve been testing on is Solaris 8.

The script needs to be run as user smuser out of cron:

  15 1 * * * /apps/smuser/bin/rotate-smlogs 1>/apps/siteminder/backup_logs/rotate-smlogs.log 2>&1

rotate-smlogs (ksh)

# Call the rsync-smlogs script to perform the transfer

/apps/smuser/bin/rsync-smlogs $YMON

$YMON resolves to 2012-01

The part of the script in rsync-smlogs that has an issue
I added the echo for debugging

     echo "sending $backupdir/smaccess*.log nic_sshd@20.2.18.31:'CA\ SITEMINDER_${HENT[0]}/'"
     # Send to Audit Log Assurance (20.2.18.31) to \CA SITEMINDER_<IPADDR>\
     /usr/local/bin/scp -i $HOME/.ssh/id_logs \
            $backupdir/smaccess*.log \
            nic_sshd@20.2.18.31:CA\ SITEMINDER_${HENT[0]}/

This is what I see in the log file

  scp: CA: Not a directory.

I changed the script to use

nic_sshd@20.2.18.31:'CA\ SITEMINDER_${HENT[0]}/'

This worked when I did it manually:

  su - smuser (this is a ksh)
  /apps/smuser/bin/rsync-smlogs 2012-01
   
  smaccess.log                                                           100%   89MB 842.0KB/s   01:48

So I updated all the other servers with the updated script, however, it seems it only worked once. If I run the script or do it manually, it�s failing again:

scp: CA\: Not a directory.

Someone from the monitoring team has access to the Windows server. He says the envision software doesn�t allow him to change the directory name to remove the space in the name. He also says he can scp files to a directory name with a space in it from another Windows PC using putty or from a Linux server.

On PC, send part of script

  W:\pscp.exe E:\lsdata-stat.txt nic_sshd@20.2.18.31:"CA SITEMINDER TEST"

On Linux, send part of script

scp file_name nic_sshd@20.2.18.31:"CA SITEMINDER TEST"
   
ssh polus2
vi /apps/smuser/bin/rsync-smlogs
nic_sshd@20.2.18.31:'CA\ SITEMINDER_${HENT[0]}/'
   
su - smuser
   
vi rsync-smlogs
echo "sending $backupdir/smaccess*.log nic_sshd@20.2.18.31:'CA\ SITEMINDER_${HENT[0]}/'"
   
$ /apps/smuser/bin/rsync-smlogs 2012-01
sending /apps/siteminder/backup_logs/smaccess*.log nic_sshd@20.2.18.31:'CA\ SITEMINDER_20.137.241.133/'
   
scp: CA\: Not a directory.

try using bash like from a Linux server

$ bash
bash-2.03$
   
scp -i /apps/smuser/.ssh/id_logs /apps/siteminder/backup_logs/smaccess*.log \
nic_sshd@20.2.18.31:"CA SITEMINDER_20.137.241.133/"
   
scp: CA: Not a directory.

Does anyone have an insight into how to resolve this problem?

Escape the space.

 scp localfile host:"dir\ with\ spaces"

Thanks for the reply, however, I am already escaping the space with a \. The last tests at the end of my post were to try what is alleged to have worked on a Linux box.

su - smuser
scp -i /apps/smuser/.ssh/id_logs /apps/siteminder/backup_logs/smaccess*.log nic_sshd@20.2.18.31:'CA\ SITEMINDER_20.137.241.133/'
scp: CA\: Not a directory.

Technically I used double quotes, but the result ought to be the same in this case.

It certainly works for me, so I'm beginning to suspect the problem isn't the linux client but the remote ssh server, where that sort of expansion actually happens.