You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Holger Rauch <ho...@heitec.de> on 2004/10/13 14:23:50 UTC

flatten mapper for scp task?

Hi!

I'm using the scp task of Ant 1.6.2 in order to copy some SQL scripts
which are stored in various directories on the source system to
a target system. On the target system, I want all .sql files to
appear below a single directory. How can I achieve this if scp
doesn't support neither

<flattenmapper />

nor 

<mapper type="flatten" /> ?

Here's what I tried:

<target name="ssh-multi-flat">
   <scp todir="${target.user}@${target.host}:${target.dir}" 
        keyfile="${user.home}/.ssh/id_dsa"
        passphrase="">
     <fileset dir="${user.home}/${source.dir}">
       <include name="**/*.sql"/>
     </fileset>
     <mapper type="flatten" />
  </scp>
</target>

(I know the "mapper" element is wrong; if I omit it, the stuff is copied to
the target system *including* the subdirs).

Thanks in advance for any info!

Kind regards,

	Holger

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


Re: flatten mapper for scp task?

Posted by Ivan Ivanov <ra...@yahoo.com>.
--- Holger Rauch <ho...@heitec.de> wrote:

> Hi Ivan!
> 
> First of all, thanks a lot for your quick reply!
> 
> I verified your suggestion and it works indeed.
> Thanks a lot!
> Nevertheless, I still think something like a
> flatten="true" attribute or
> a corresponding <mapper> element could save a lot of
> typing. Are there plans
> to enhance the scp task in this way? 

I do not know whether ant developers plan to do it.
You can ask them directly, or you can add a bug report
to ant bugzilla ant vote or write the patch yourself
and submit it :)).

> (It would make sense since scp is
> basically a variant of the copy task, with the
> exception that scp is
> primarily determined for copying files to remote
> machines.)
> 
> Greetings,
> 
> 	Holger
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: flatten mapper for scp task?

Posted by Holger Rauch <ho...@heitec.de>.
Hi Ivan!

First of all, thanks a lot for your quick reply!

On Wed, 13 Oct 2004, Ivan Ivanov wrote:

> How about first copying the files to a temporary
> directory and then scp'ing to the server and finally
> deleting then from tmp:
> [...]

I verified your suggestion and it works indeed. Thanks a lot!
Nevertheless, I still think something like a flatten="true" attribute or
a corresponding <mapper> element could save a lot of typing. Are there plans
to enhance the scp task in this way? (It would make sense since scp is
basically a variant of the copy task, with the exception that scp is
primarily determined for copying files to remote machines.)

Greetings,

	Holger

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


Re: flatten mapper for scp task?

Posted by Ivan Ivanov <ra...@yahoo.com>.
How about first copying the files to a temporary
directory and then scp'ing to the server and finally
deleting then from tmp:

<mkdir dir="${java.io.tmpdir}/tmpsqls"/>
<copy todir="${java.io.tmpdir}/tmpsqls"
flatten="true">
    <fileset dir="${user.home}/${source.dir}">
        <include name="**/*.sql"/>
    </fileset>
</copy>
<scp
todir="${target.user}@${target.host}:${target.dir}" 
    keyfile="${user.home}/.ssh/id_dsa"
    passphrase="">
    <fileset dir="${java.io.tmpdir}/tmpsqls">
        <include name="**/*.sql"/>
    </fileset>
</scp>
<delete dir="${java.io.tmpdir}/tmpsqls"/>

HTH Ivan


--- Holger Rauch <ho...@heitec.de> wrote:

> Hi!
> 
> I'm using the scp task of Ant 1.6.2 in order to copy
> some SQL scripts
> which are stored in various directories on the
> source system to
> a target system. On the target system, I want all
> .sql files to
> appear below a single directory. How can I achieve
> this if scp
> doesn't support neither
> 
> <flattenmapper />
> 
> nor 
> 
> <mapper type="flatten" /> ?
> 
> Here's what I tried:
> 
> <target name="ssh-multi-flat">
>    <scp
> todir="${target.user}@${target.host}:${target.dir}" 
>         keyfile="${user.home}/.ssh/id_dsa"
>         passphrase="">
>      <fileset dir="${user.home}/${source.dir}">
>        <include name="**/*.sql"/>
>      </fileset>
>      <mapper type="flatten" />
>   </scp>
> </target>
> 
> (I know the "mapper" element is wrong; if I omit it,
> the stuff is copied to
> the target system *including* the subdirs).
> 
> Thanks in advance for any info!
> 
> Kind regards,
> 
> 	Holger
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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