ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson, Rob (Global Trade)" <Rob.Ander...@nike.com>
Subject RE: Question about scp
Date Tue, 15 Jul 2008 00:07:06 GMT
You need to use a nested fileset in your scp task. In order to do this
you would need to run ant on the host where the files reside. You cannot
use a nested fileset as a source for the copy when they are on a remote
host. I would setup cygwin sshd on the windows box and run ant on the
linux box.



-Rob Anderson


-----Original Message-----
From: Reinhardt Christiansen [mailto:rhino1@sympatico.ca] 
Sent: Saturday, July 12, 2008 7:15 AM
To: ant-user
Subject: Question about scp

I am successfully using the Ant (1.7.0) scp task in Ant 1.7.0 but I have

some questions that don't seem to be answered in the documentation.

With respect to scp, is it possible to copy a whole directory tree from 
a local machine to a remote machine?

Let's say I have this directory tree on my remote (Linux) machine:

/home
/home/abc
/home/abc/css
/home/abc/images
/home/abc/images/thumbnails
/home/abc/images/thumbnails/new
/home/abc/images/fullsize
/home/abc/text
/home/abc/text/foo
/home/abc/text/foo/old
/home/abc/text/foo/new
/home/abc/text/bar
/home/abc/text/baz

Each directory contains files and most also contain subdirectories.

Now, I'd like to take a backup of this information on my local (Windows)

machine. That backup should replicate the structure on the remote 
machine, like this:

c:\backups\abc
c:\backups\abc\css
c:\backups\abc\images
c:\backups\abc\images\thumbnails
c:\backups\abc\images\thumbnails\new
c:\backups\abc\images\fullsize
c:\backups\abc\text
c:\backups\abc\text\foo
c:\backups\abc\text\foo\old
c:\backups\abc\text\foo\new
c:\backups\abc\text\bar
c:\backups\abc\text\baz

I'm finding that I can copy a partial directory tree from the remote 
machine to the local machine without any trouble. For example, if I want

to copy the /home/abc/images directory _and all of its subdirectories_ 
on the remote machine to the local machine, I can do it easily enough
via:

    <scp 
file="${loginid}@${remote.hostname}:${remote.root.dir}/images/*" 
trust="true"
          keyfile="${remote.keyfile}" passphrase="${passphrase}" 
        todir="${local.dir}/images"/>


However, when I try to copy a partial directory from the local machine 
to the remote machine, it only ever copies the highest level directory 
and won't recurse to the lower levels. For example, if I want to copy 
c:\backups\abc\text to the remote machine, It only copies the 
c:\backups\abc\text directory and never recurses down to any of the 
subdirectories below c:\backups\abc\text.

I'm guessing that I just haven't written the scp instructions correctly.

As is all too often the case, I'm finding that the examples in the Ant 
manual for a given command either don't show you an example of what 
you're trying to do or fail to explain it very well. In the case of scp,

the examples that show copying directories from a local machine to a 
remote machine don't indicate if they _can_ recurse, let alone how to 
make it recurse if it is possible.

Is it possible to recurse through subdirectories when copying from a 
directory on a local machine to a remote machine? If it is, could 
someone please tell me what I'd need to write to copy 
c:\backups\abc\text and all of its subdirectories to the remote machine?

I've tried it every way I can think of but it never recurses.


--
Rhino

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message