I am trying to download files from FTP on a machine in another domain and having password protection.
Do I have to supply the username and password while connecting programatically as shown below. The code as such is not working?
posted 7 years ago
Yes, you do need to provide username and password. They can be passed in as part of the URL; I think the syntax is something like "ftp://username:password@host/file". Searching for "ftp url syntax" will tell you for sure.
Alternatively you can use an FTP client library like Apache Commons Net, which supports more advanced FTP operations like downloading multiple files and uploading files.