Subscribe Bookmark RSS Feed

How to create a JMP script that pulls data from multiple directories using FTP?

chadw

Community Trekker

Joined:

Jul 9, 2014

Hello,

I am trying to create a JMP script that would connect to an FTP server and then pull in datasets from multiple directories.  Using the File > Open Internet, I have been able to connect to the FTP server and view it as a web page but I am limited to only the Home directory.

So my question is, is it possible to create a JMP script that connects to an FTP server and then navigate to pre-defined directories to pull in data?

Thanks for the help!

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

If your JMP program runs in Windows, you can create the FTP script and run it using JSL.

Below the JSL example copies all files having names starting with FILE_NAME in the FTP directory using mget command.

ftp_txt="

\!nopen 192.168.1.10

\!nuser FTP_USER_ID PASSWORD

\!nftp

\!ncd FOLDER/LOCATION/

\!nlcd C:\LOCAL\FOLDER

\!nprompt

\!nmget FILE_NAME*

\!nbye

\!n

";

save text file("c:\test.ftp",ftp_txt);

cmd_txt = "ftp -v -n -s:c:\test.ftp";

save text file("c:\jmp_ftp.bat",cmd_txt);

wait(1);

open("c:\jmp_ftp.bat");

3 REPLIES
Solution

If your JMP program runs in Windows, you can create the FTP script and run it using JSL.

Below the JSL example copies all files having names starting with FILE_NAME in the FTP directory using mget command.

ftp_txt="

\!nopen 192.168.1.10

\!nuser FTP_USER_ID PASSWORD

\!nftp

\!ncd FOLDER/LOCATION/

\!nlcd C:\LOCAL\FOLDER

\!nprompt

\!nmget FILE_NAME*

\!nbye

\!n

";

save text file("c:\test.ftp",ftp_txt);

cmd_txt = "ftp -v -n -s:c:\test.ftp";

save text file("c:\jmp_ftp.bat",cmd_txt);

wait(1);

open("c:\jmp_ftp.bat");

chadw

Community Trekker

Joined:

Jul 9, 2014

Thanks for this solution jara95!  It is kind of round-about way of going about it, but it definitely works.

Craige_Hales

Staff

Joined:

Mar 21, 2013

JMP 11 has another way to use programs like FTP, see this post on the RunProgram function which lets you control command line programs by sending them commands from JSL and reading their output with JSL.

Thanks to jara95 for the hint on the FTP options and commands...I needed that.

Craige