commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Baumgartner <poindex...@yahoo.com>
Subject Help with change directory
Date Mon, 25 Jul 2011 20:41:54 GMT
I'm new to Apache Commons  (3.0.1), and am writing a Java program to FTP a file on my local
server to an FTP server on the same network.  
 
First, I'd like to make sure that changeWorkingDirectory() changes the directory on the remote
machine.  It's not clear from the documentation.
 
The first thing hat happens is that the "Change Directory didn't work" prints out.  but I
don't know what went wrong.  So, I'm trying to use getReply() for more information, but my
program hangs on that line.  I know this becuase the line before it prints, but not the line
after it.
 
Here's a code snippet:
 
FTPClient ftp = new FTPClient();
ftp.connect (server);
 
// status checking here - print statements indicate that connect was successful
 
boolean OK = ftp.changeWorkingDirectory ("/tmp/dir_name");
if {OK} {
  System.out.println ("Change directory worked");
} else {
  System.out.println ("Change directory didn't work");
  system.out.println ("The FTP Reply Code is");
  
 reply = ftp.getReply();  // reply was defined as int before doing the connect previous
to this
  System.out.println (Reply);
}
 
Thanks for any help you can offer.  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message