commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anil Philip <goodnewsfor...@yahoo.com>
Subject Re: [commons-net ftp] how to ftp a zipped file and unzip it at the other end?
Date Wed, 16 Aug 2006 13:33:42 GMT
Thank you for replying.
How do I upload and unzip?
ie. suppose that my only access to the machine is thru
commons-net ftp.
after some googling, I find that net2ftp has this
functionality, but apparently manually from a web
page. Does one need to also telnet?
thanks,
Anil

--- Bjarne Pedersen / Schmiedmann
<web@schmiedmann.com> wrote:

> Hi Anil
> 
> I have this snippet (dont if it work, have not tryed
> it)
> 
> import java.io.*;
> import java.util.zip.*;
> 
> public class UnZip {
>    final int BUFFER = 2048;
>    public static void main (String argv[]) {
>       try {
>          BufferedOutputStream dest = null;
>          FileInputStream fis = new
> 	   FileInputStream(argv[0]);
>          ZipInputStream zis = new
> 	   ZipInputStream(new BufferedInputStream(fis));
>          ZipEntry entry;
>          while((entry = zis.getNextEntry()) != null)
> {
>             System.out.println("Extracting: "
> +entry);
>             int count;
>             byte data[] = new byte[BUFFER];
>             // write the files to the disk
>             FileOutputStream fos = new
> 	      FileOutputStream(entry.getName());
>             dest = new
>               BufferedOutputStream(fos, BUFFER);
>             while ((count = zis.read(data, 0,
> BUFFER))
>               != -1) {
>                dest.write(data, 0, count);
>             }
>             dest.flush();
>             dest.close();
>          }
>          zis.close();
>       } catch(Exception e) {
>          e.printStackTrace();
>       }
>    }
> }Bjarne 
>
Pedersen--------------------------------------------------------------------------------
> 
> Med venlig hilsen / Best regards / Mit freundlichen
> GrĂ¼ssen IT-Ansvarlig 
> Bjarne Pedersen SCHMIEDMANN ODENSE Sandvadvej 9,
> Korup 5210 Odense NV Tlf. 
> +45 65 94 15 45 Fax +45 65 94 00 98 E-Mail
> Web@schmiedmann.com web 
> www.schmiedmann.com CVR. Nr. DK20549548
> ----- Original Message ----- 
> From: "Anil Philip" <goodnewsforyou@yahoo.com>
> To: <commons-user@jakarta.apache.org>
> Sent: Wednesday, August 16, 2006 3:09 PM
> Subject: [commons-net ftp] how to ftp a zipped file
> and unzip it at the 
> other end?
> 
> 
> Hello,
> I have an html file and its associated folder on a
> Windows desktop. e.g. myPage.html and myPage_files.
> I
> need to save it remotely to a Linux machine. So I
> use
> ftp. However it is inefficient to transfer each file
> across piecemeal.
> I was thinking it might be smarter to zip it up and
> ftp it across.
> Qs. How do I unzip it at the other end?
> (of course, this is done by my program, not
> manually).
> thanks,
> Anil
> 
> for good news go to
>
http://members.tripod.com/~goodnewsforyou/goodnews.html
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message