I usually achieve this by using task.ijs to call the command-line ftp client on 
Windows.

Mac -: Linux now, so it'll have a comparable tool.  You may have to use some 
OS-conditional logic to tweak the parameters (command line).

See  ftp /?  on Windows and  man ftp  Mac.  

I don't think there's a way to avoid intermediate files for data, but you can 
store your data in jpath'~temp' and use dyadic spawn to pass a script in to 
ftp's stdin without needing a batch file or shell script.

The client can download as well as upload; use the  ls  or  dir  commands to 
get a directory listing.

If the process fails, the client will just quit, and the result of  spawn. will 
let you know that (and why).

-Dan

Please excuse typos; composed on a handheld device.

-----Original Message-----
From: Ian Clark <[email protected]>
Date: Thu, 26 Nov 2009 14:44:55 
To: General forum<[email protected]>
Subject: [Jgeneral] FTP uploader needed

I need a routine to upload a given file (or better: a J character
string) to a remote FTP site. I don't need a top-end like FileZilla.
The username, password, port, remote directory, filename can all be
hard-coded or passed as parameters.

I don't need a flexible FTP session, except maybe to debug it when
working with a new site. It just needs to abort if the session goes
wrong. It would be nice if it could download as well as upload,
especially to download the directory of the remote target folder.

I have just such a routine written in APL+Win which I've found quite
satisfactory in use, but this only works in Windows. I want to port
the APL+Win apps that make use of it to the Macintosh, for which I
don't have development tools nowadays, so (presumably) it needs to be
written in J.

Ian Clark
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to