Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
6.1k views
in Java FTP by (120 points)
I am using one FTP client program which is used to download the files from my FTP server which is running in Sun solaris machine. If i try the same program to connect to one FTP server which is running in Windows plateform I have problem.. In the FTPClient class's get() method if dont pass any argument then it is working fine. But If I pass a directory name (c:/myfolder/) in that method, the same program is not working properly.
It takes the folder name as "c:/myfolder/:" (addes ':' )...

Please guide me what would be the problem.

Thanks in advance.

Shan

3 Answers

0 votes
by (162k points)
Please post a code snippet that demonstrates the problem.

I am using one FTP client program which is used to download the files from my FTP server which is running in Sun solaris machine. If i try the same program to connect to one FTP server which is running in Windows plateform I have problem.. In the FTPClient class's get() method if dont pass any argument then it is working fine. But If I pass a directory name (c:/myfolder/) in that method, the same program is not working properly.
It takes the folder name as "c:/myfolder/:" (addes ':' )...

Please guide me what would be the problem.

Thanks in advance.

Shan
0 votes
by
ftp = new FTPClient(destinationFTPHost);
FTPMessageCollector listener = new FTPMessageCollector();
ftp.setMessageListener(listener);
ftp.login(userName, password);
ftp.setConnectMode(FTPConnectMode.PASV); // ftp.setConnectMode(FTPConnectMode.PASV);
ftp.setType(FTPTransferType.ASCII); // ftp.setType(FTPTransferType.ASCII);
System.out.println("***** FTP Sever Connection is Opening *****");

String[] downLoadFilesList = ftp.dir("c:/wasapps/common/daily/", false); // problem
for (int i = 0; i < downLoadFilesList.length; i++) {
System.out.println("***** dir[i] =====> " + downLoadFilesList[i]);
}
0 votes
by (162k points)
You can't use dir(..., false) as below.

Most FTP servers will not understand drive letters.

instead, chdir() to the directory you want and use dir().

String[] downLoadFilesList = ftp.dir("c:/wasapps/common/daily/", false);

Categories

...