We help IT Professionals succeed at work.

How to Compress a File Using C# During an FTP Transfer

thenthorn1010
on
Medium Priority
741 Views
Last Modified: 2013-12-16
I am attempting to write an application that will require the significant use of bandwidth to ftp a file from a limited network connection site, and I was wondering if there was a way to compress a file before you download it using C# .NET. I have seen mention of a compression method for SFTP, but I have not been able to find anything on compressing files using FTP by itself within a C# application. Could someone help me by providing example code for how to complete such a task, or point me to a site that would do that without having to purchase a third party library?

Any help that you could provide would be greatly appreaciated.
Comment
Watch Question

MisbahSr. Software Engineer
CERTIFIED EXPERT

Commented:
do you have access or permission to host some app on the ftp server ?
if yes, then you can build a small server side tool, that you can call to compress the file before you download it.
Commented:
If you mean can you compress the data while in transfer, then no, FTP does not support compression.  However if you mean can you compress the file by executing a command on the remote server, and then decompressing it after download, you can do that only if you have remote access through something like SSH (though if you can use SSH, you'd be better off transferring the file via scp or sftp, which can compress the file and also encrypts the datastream).
Commented:
Many FTP clients and servers support MODE Z on the fly compression.  Google it.

Author

Commented:
Dr-Hussain,

I do not have permissions to add a application to the server that I am attempting to FTP the files from.