/usr/bin/scp error

I have this scp script running,

/usr/bin/scp -r /cerner/mgr --exclude-from=/atg/move_exclude.dat 102.126.112.68:/cerner

but am getting an error:

--exclude-from=/atg/move_exclude.dat: No such file or directory

I am wondering if the syntax is incorrect...

I also have additional questions, please.

1) why the destination directory has to be specified with the upper directory?

I assumed it has to be

/usr/bin/scp -r /cerner/mgr --exclude-from=/atg/move_exclude.dat 102.126.112.68:/cerner/mgr

, but

/mgr

has to be removed from the destination directory.

2) With scp, is there a way to skip the same file with the same size if the destination directory has the file?

Please advise. Appreciate your help!

What OS are you using (i.e., output from uname -a ).

Source is AIX 5.3, and destination is AIX 6.1

Yes, it is incorrect. I think you are confusing scp with rsync . scp does not support the exclude-from feature.

       Some of the additional features of rsync are:

       o      support  for copying links, devices, owners, groups, and permis
              sions

       o      exclude and exclude-from options similar to GNU tar
  1. Regarding scp, I think your assumption is right, but for the first time of scp-ing only. When you scp the second time, then you need to remove the uppermost target directory, because it already exists. You should check out the following trick with rsync and the trailing slash:
       A trailing slash on the source changes this behavior to avoid  creating
       an  additional  directory level at the destination.  You can think of a
       trailing / on a source as meaning "copy the contents of this directory"
       as  opposed  to  "copy  the  directory  by name", but in both cases the
       attributes of the containing directory are transferred to the  contain
       ing  directory on the destination.  In other words, each of the follow
       ing commands copies the files in the same way, including their  setting
       of the attributes of /dest/foo:

              rsync -av /src/foo /dest
              rsync -av /src/foo/ /dest/foo
  1. Not with scp, but I think it's the default behaviour of rsync.

I hope this helps.

1 Like