I have written a java program which on running will ask the source path and dest path, giving so it will copy the list of files from source directory to dest directory. But here my requrement is to copy the files from my windows machine to a unix machine over ftp. I have all the required ip, userid, password, port number and ofcourse the dest directory of my ftpserver with me. Can anyone help me now further
Srinivasa Maddi wrote:Thanks for quick response.
But my requirement is not to use any third party jars here.
That's really silly. But given that constraint: you need to learn about the FTP protocol, and implement the client half. It's relatively complicated protocol that uses two separate client/server connections. Here's the protocol reference. Have fun!
URL url = new URL("ftp://user:password@ftp_server_ip:/export/home/fcdev");
Could you please suggest me if i want to upload my files to /export/home/fcdev directory of the above ftp server. How can i code it.
On my FTP server, if I give a first-level directory (i.e. "/www"), the URL will return a directory listing. If I use a non-root directory (i.e. "/www/images"), just the directory name will throw a FileNotFoundException. If I add the slash (i.e. "/www/images/"), I get the directory list.
Joined: Apr 18, 2007
Please see my code below(correct me if i am wrong)