2
$\begingroup$

I found relevant information on the problem for Linux or MacOS, but I run programmes under Windows.

I want to connect to a friend's FTP server to download some files. Of course the server has wants a username and password, and my friend offered me this.

At the beginning, I tried to use Import like this:

Import["username:passward@ftp://ip_address/diretory/filename"]

Mathematica tells me that it is not a effective filename.

Another friend tells me to move username and password after ftp, like this:

"ftp://username:password@ip_address/directory/filename"

Seems it is recognized as a correct file, but I get an error telling me some problem happened at FetchURL. It says

The server returned the HTTP status code 400 ("Bad Request").

Next I tried another way to use Import. Like this:

Import[
  "ftp://ip_address/directory/filename", 
  "Username" -> username, "Password" -> password]

I got the same response with HTTP 400 Error.

Am I going about trying to make a FTP connection in the wrong way?

Could I get some help so I can successfully download a file form ftp server?

$\endgroup$
  • $\begingroup$ Have a look at CopyFile and RemoteFile and see if that might help you. $\endgroup$ – Carl Lange Mar 5 at 16:54
  • 1
    $\begingroup$ What happens if you try to open the URL "username:password@ip_address/directory/filename" in a browser? $\endgroup$ – Rohit Namjoshi Mar 5 at 22:14
  • $\begingroup$ @RohitNamjoshi It opens as i expected,and nothing happened seems an error $\endgroup$ – deuterium Mar 7 at 3:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.