Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
help! how to send multiple files to remote machine? ant-jsch

help! how to send multiple files to remote machine? ant-jsch

2007-04-17       - By PHILIPPE Johan
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

How do you mean 'replies'?

Isn't this the solution !!

You've got two examples of fileset there, and there are more in this
specific section in the ANT docs.


> -----Original Message-----
> From: Anil Philip [mailto:goodnewsforyou@(protected)]
> Sent: maandag 16 april 2007 0:34
> To: user@(protected)
> Subject: RE: help! how to send multiple files to remote machine?
ant-jsch
>
> No replies?
>
> --- Anil Philip <goodnewsforyou@(protected)> wrote:
>
> > I am using scp programmatically, but I found this
> > task
> > here with wildcards, in the examples documentation
> > -
> > Anil
> > .
> >
> > Copy a set of files to a directory
> >
> >   <scp todir="user:password@(protected):/home/chuck">
> >     <fileset dir="src_dir">
> >       <include name="**/*.java"/>
> >     </fileset>
> >   </scp>
> >
> >   <scp todir="user:password@(protected):/home/chuck">
> >     <fileset dir="src_dir" excludes="**/*.java"/>
> >   </scp>
> >
> >
> > --- Anil Philip <goodnewsforyou@(protected)> wrote:
> >
> > > Thank you for replying.
> > > Is there an example I can look at for transferring
> > > multiple files?
> > > I did a google search but was unable.
> > > thanks,
> > > Anil
> > >
> > > --- "Anderson, Rob (Global Trade)"
> > > <Rob.Anderson@(protected)> wrote:
> > >
> > > > The wildcard is not resolved in ant. This is a
> > > > common mistake as people
> > > > expect Ant to resolve wildcards as a shell
> > would.
> > > > You would need to use
> > > > a fileset.
> > > >
> > > > -Rob Anderson
> > > >
> > > > > -----Original Message-----
> > > > > From: Anil Philip
> > > > [mailto:goodnewsforyou@(protected)]
> > > > > Sent: Wednesday, April 11, 2007 12:13 PM
> > > > > To: user@(protected)
> > > > > Subject: help! how to send multiple files to
> > > > remote machine? ant-jsch
> > > > >
> > > > > Have you used scp to send the files from an
> > > entire
> > > > folder?
> > > > > Is there *another* way besides using
> > wildcards?
> > > > > I was sending it one file at a time and it
> > would
> > > > send two and
> > > > > then stop.
> > > > > I am trying to get it to send all the files at
> > > > once.
> > > > > But when I specify
> > > > > D:\outbound\*
> > > > >  then I get
> > > > >
> > > > >  java.io.FileNotFoundException: D:\outbound\*
> > > (The
> > > > filename,
> > > > > directory name, or volume label syntax is
> > > > > incorrect)
> > > > >
> > > > >                at
> > > > >
> > > >
> > >
> >
> org.apache.tools.ant.taskdefs.optional.ssh.Scp.execute(Scp.java:215)
> > > > >
> > > > > -
> > > > >
> > > > > thanks,
> > > > >
> > > > > Anil Philip
> > > > >
> > > > >
> > > > >        void sendFiles(File outFolder) throws
> > > > IOException {
> > > > >         Scp sendFile = new Scp();
> > > > >         Project proj = new Project();
> > > > >         proj.init();
> > > > >         sendFile.setProject(proj);
> > > > >         sendFile.setPort(22);
> > > > >         sendFile.setTrust(true);
> > > > >         sendFile.setFile(outFolder.getPath() +
> > > > File.separator + "*");
> > > > >         String hostUri = remoteUserName + "@"
> > +
> > > > remoteUrl +
> > > > > ":" + remotePath;
> > > > >         sendFile.setTodir(hostUri);
> > > > >         sendFile.setKeyfile(remoteKeyFile);
> > > > >         sendFile.setPassphrase("");
> > > > >         logger.debug("about to SCP the file "
> > +
> > > > > outFolder.getName() + "
> > > > > to Sprint");
> > > > >         sendFile.execute();
> > > > >         // send all files in the out dir
> > > > >         // Move the file to the done directory
> > > > >         File[] files = outFolder.listFiles();
> > > > >         for(File outFile:files) {
> > > > >             copy(outFile,new
> > > > > File(sentFolder.getAbsolutePath() +
> > > File.separator
> > > > +
> > > > > outFile.getName()));
> > > > >             outFile.delete();
> > > > >             if(outFile.exists())
> > > > >                 logger.error("Failed to move
> > the
> > > > file"
> > > > > +
> > > > > outFile.getName() + " to the done directory");
> > > > >             else
> > > > >                 logger.debug("Moved the file "
> > +
> > > > > outFile.getName() + "
> > > > > to the done directory");
> > > > >         }
> > > > >     }
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> ______________________________________________________________
> > > > > ______________________
> > > > > Sucker-punch spam with award-winning
> > protection.
> > >
> > > > > Try the free Yahoo! Mail Beta.
> > > > >
> > > >
> > >
> >
> http://advision.webevents.yahoo.com/mailbeta/features_spam.html
> > > > >
> > > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > > user-unsubscribe@(protected) For
> > > > > additional commands, e-mail:
> > > > user-help@(protected)
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > > user-unsubscribe@(protected)
> > > > For additional commands, e-mail:
> > > > user-help@(protected)
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> >
>
________________________________________________________________________
__
> __________
> > > Food fight? Enjoy some healthy debate
> > > in the Yahoo! Answers Food & Drink Q&A.
> > >
> >
> http://answers.yahoo.com/dir/?link=list&sid96545367
> > >
> >
> >
> >
> >
> >
>
________________________________________________________________________
__
> __________
> > Don't pick lemons.
> > See all the new 2007 cars at Yahoo! Autos.
> > http://autos.yahoo.com/new_cars.html
> >
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)



STRICTLY PERSONAL AND CONFIDENTIAL
This message may contain confidential and proprietary material for the sole use
of the intended recipient. Any review or distribution by others is strictly
prohibited. If you are not the intended recipient please contact the sender and
delete all copies.

Dit bericht is enkel bestemd voor de aangeduide ontvangers en kan
vertrouwelijke informatie bevatten. Als u niet de ontvanger bent, dan mag u de
inhoud van dit bericht niet bekendmaken noch kopi?ren. Als u dit bericht per
vergissing ontvangen heeft, gelieve er de afzender of De Post onmiddellijk van
op de hoogte te brengen en het bericht vervolgens te verwijderen.

Ce message est uniquement destin? aux destinataires indiqu?s et peut contenir
des informations confidentielles. Si vous n'?tes pas le destinataire, vous ne
devez pas r?v?ler le contenu de ce message ou en prendre copie. Si vous avez re
?u ce message par erreur, veuillez en informer l'exp?diteur, ou La Poste imm
?diatement, avant de le supprimer.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.