You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Anil Philip <go...@yahoo.com> on 2007/04/11 21:13:24 UTC
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@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: help! how to send multiple files to remote machine? ant-jsch
Posted by Anil Philip <go...@yahoo.com>.
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)"
<Ro...@nike.com> 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@yahoo.com]
> > Sent: Wednesday, April 11, 2007 12:13 PM
> > To: user@ant.apache.org
> > 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@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
>
>
____________________________________________________________________________________
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: help! how to send multiple files to remote machine?
ant-jsch
Posted by "Anderson, Rob (Global Trade)" <Ro...@nike.com>.
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@yahoo.com]
> Sent: Wednesday, April 11, 2007 12:13 PM
> To: user@ant.apache.org
> 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@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