Hi,

This is an excerpt of some code I wrote to do someting similar
The idea is to spwan an 'ftp' subprocess a send commands to it as if you are
typing at the ftp> prompt.
I cant send you more than this since my employer could have a fit!

--Olu E.

final String execStr = "/usr/bin/ftp -i -v -n " + remoteHostname;

        boolean oK = false;
        _proc = null;

        try
        {
                Runtime runTime = Runtime.getRuntime();

                _proc = runTime.exec(execStr);
                _istrm = new BufferedReader(new
InputStreamReader(_proc.getInput
Stream()));
                _ostrm = new PrintWriter(new BufferedWriter( new
OutputStreamWri
ter(_proc.getOutputStream())));
                read_all_responses(); //Read the responses of the connection
att
empt!!
                if(! responded_with("Connected to"))
                {
                        throw new StsFtpException("Ftp error! Unknown host
[" + remoteHostname + "]");
                }

                send("user " + user + " " + paswd);

etc.... etc....

--Olu E.


----- Original Message -----
From: Lomesh Contractor <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday,April 29,1999 2:24 AM
Subject: How can I ?


> hi...
>         How can I , simulate FTP utilities with servlets?
> i.e.
>         - copy files(upload files) from client to server.
>         - make directories on server.
>         - move files from one folder to another on server.
>
> in short, i want to give web based ftp utilities to clients using servlet.
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to