473,503 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

zip files using C#

Is it possible to read a directory and zip the files within that directory using C#?
What I'm trying to do is, create a process (windows service, console app, etc) that will read a directory that stores log files. I want to then take all the log files that are 6 months or older and zip them automatically.

So if the job ran today, It would look for files that are 6 months old and older from today and zip them and then move that zip file into an archive folder. I would like this to run on a weekly basis which I would schedule via windows task scheduler. Is this something that can be done using C#?
Nov 9 '07 #1
2 5058
There is a .net library for this called sharpziplib available at
http://icsharpcode.net/. It works quite well.
"Mike" wrote:
Is it possible to read a directory and zip the files within that directory using C#?
What I'm trying to do is, create a process (windows service, console app, etc) that will read a directory that stores log files. I want to then take all the log files that are 6 months or older and zip them automatically.

So if the job ran today, It would look for files that are 6 months old and older from today and zip them and then move that zip file into an archive folder. I would like this to run on a weekly basis which I would schedule via windows task scheduler. Is this something that can be done using C#?

Nov 9 '07 #2
This article shows how to use SharpZipLib to traverse a folder tree, gather
and zip files, and pretty much do most of what you are asking for:
http://www.eggheadcafe.com/articles/20041210.asp

--Peter
http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Mike" wrote:
Is it possible to read a directory and zip the files within that directory using C#?
What I'm trying to do is, create a process (windows service, console app, etc) that will read a directory that stores log files. I want to then take all the log files that are 6 months or older and zip them automatically.

So if the job ran today, It would look for files that are 6 months old and older from today and zip them and then move that zip file into an archive folder. I would like this to run on a weekly basis which I would schedule via windows task scheduler. Is this something that can be done using C#?

Nov 9 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
14143
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
5
3390
by: Brian | last post by:
I need to import data from 720 csv files into an Access database so I can do some editing prior to loading into a SQL Server. These files came from data output from a mainframe on a monthly basis....
11
5544
by: ambika | last post by:
Iam just trying to know "c". And I have a small doubt about these header files. The header files just contain the declaration part...Where is the definition for these declarations written??And how...
14
7292
by: Mick | last post by:
I wrote a C# program that interfaces with a data vendor over the web using an API they supplied and their examples in C#. Now I have another data vendor's API and example that I want to add to...
8
2366
by: RML | last post by:
hey guys, i am looking at this piece of code that lists numbers of files in a directory. i want to convert it so it lists the files in th directory that end with .doc. i cant seem to get it to...
2
2350
by: Glen | last post by:
As I understand it, when the first page of an application is accessed, all ASPX/ASCX/etc. files in the same folder are compiled using the JIT compiler. Is there a way to turn this feature off? ...
18
2272
by: UJ | last post by:
Folks, We provide custom content for our customers. Currently we put the files on our server and people have a program we provide that will download the files. These files are usually SWF, HTML or...
5
3409
by: rogersw8n | last post by:
Some how, some way the account that creates folders under Temporary Internet files has been changed to a domain account for VS 2003 and VS 2005. I recently installed VS 2005. All seemed to be ok...
21
34322
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
221
366957
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7084
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7458
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5013
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.