FTPClient FTPClient=new FTPClient ();
//login connection
Int the reply;
if(! FtpClient. IsConnected ()) {
FtpClient. Connect (url, port);
}
//login
FtpClient. Login (username, password);
Reply=ftpClient. GetReplyCode ();
//passive mode
FtpClient. SetRemoteVerificationEnabled (false);
ftpClient.enterLocalPassiveMode();
FtpClient. SetConnectTimeout (6000);
if (! FTPReply. IsPositiveCompletion (reply)) {
FtpClient. Disconnect ();
Throw new Exception (" user or password error ");
}
Switch to the//to the FTP server directory (folder)
String the pathname="ftpfile";
Boolean changeFlag=ftpClient. ChangeWorkingDirectory (pathname);
introduction
For FTP server operating system is Linux, Linux system to the folder is not case sensitive, i.e. A and A in Linux is the same directory two folders), if the pathname="ftpFile", may be because "ftpFile" capital F, thus can't find this folder returns false;
Problem of
how do I can not change the pathname="ftpfile" value so that they can switch to the FTP server ftpfile directory?
CodePudding user response:
Linux only cfis network file system support case-insensitive. (Linux access Windows Shared directory using a network file system)To Linux use FTP does not distinguish between path case, you must first install samba, anonymous local loopback Shared directory, and then mount network path to the FTP directory, change directory permissions 777.