Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP From Unix to Windows

Status
Not open for further replies.

prasadmokashi

Programmer
Oct 31, 2003
41
US
Hi,

I am using Ant 1.6.2 to FTP files from unix server to local windows folder.

following is my code,

public static void getFiles(String ftpServer, String user, String pwd, String fileName){

try{

FTP ftpclient = new FTP();
FileSet fs = new FileSet();
File destination = new File("C:\\Pramo\\Leavers\\");
fs.setDir(destination);
fs.setIncludes("*.txt");

ftpclient.setServer(ftpServer);

ftpclient.setUserid(user);

ftpclient.setPassword(pwd);

ftpclient.setRemotedir(fileName);

FTP.Action ftpa = new FTP.Action();
ftpa.setValue("get");
ftpclient.setAction(ftpa );
ftpclient.setVerbose(true);
ftpclient.setPassive(true);
ftpclient.setProject(project);
ftpclient.addFileset(fs);
ftpclient.execute();
}
catch(Exception ex){
Log.printDebug("ERROR :" + ex.getMessage(),Config.getLogLayer(),Log.DEBUG,"FTPHelper");
}

}

But when I run through this code nothing happens. It doesn't succeed and even doesn't throw any error.

I am sure I am passing correct server, userid,pwd, and filename.

Could anybody please help me.

Thanks,
Prasad

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top