473,799 Members | 3,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Double extensions when compressing file with c# (*.GZip)

5 New Member
I have an application that saves data to a MS Access database and then compresses it. The annoyance here is that I get a double extension on my zip folder. (*.accdb.gz).

I have come up with an alternative but it causes the compressed file to not get any extension at all. The problem is that I name both the folder and the file in the same line and I'm wondering if there's a way to seperate them.

Expand|Select|Wrap|Line Numbers
  1. private void CompressFile(string DirectoryPath)
  2. {
  3.     DirectoryInfo di = new DirectoryInfo(DirectoryPath);
  4.     FileInfo fi = new FileInfo(DirectoryPath);
  5.  
  6.     using (FileStream inFile = fi.OpenRead())
  7.     {
  8.         using (FileStream outFile = File.Create(fi.Directory + "\\(" + currTime.ToShortDateString() + ")RSDB.accdb.gz"))
  9.         {
  10.             using (GZipStream Compress = new GZipStream(outFile, CompressionMode.Compress))
  11.             {
  12.                 inFile.CopyTo(Compress);
  13.             }
  14.         } 
  15.     }  
  16. }
This is the line that sets the name:
Expand|Select|Wrap|Line Numbers
  1. using (FileStream outFile = File.Create(fi.Directory + "\\(" + currTime.ToShortDateString() + ")RSDB.accdb.gz"))
Taking away the first extension leaves the file without any extension at all.
May 4 '12 #1
0 1671

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3793
by: Display Name | last post by:
the customer I'm developing a site for uses a canned form-parsing page that allows her to have an email subscription opt-in page add emails to a list she can manage using a link that you point your HTML form to. the actual form-parsing page resides on a server that's uneditable to me since it sits on an inaccessible server. my problem is more irritating than anything; everything double-submits.. when you submit the form, I've forced a...
4
3732
by: Doug R | last post by:
Hello, I could use a little help from you Gurus out there. I have an aplication that watches a directory and detects when a PGP encrypted file lands in the directory and starts a process that decrypts it and parses the resulting contents. I am using the FileSystemWatcher's Created event to detect when the file arrives. The problem I have is that these files are large(5-10 megs) and they are being transfered over a limited pipe. I...
1
4906
by: nooy66 | last post by:
I need to read value type double form my binary file. When i use Hex Workshop software read my binary file. i have data 8 bytes : hex = 3131 3131 3131 3140 string = 1111111@ Float = 2.5784852e-009 Double = 17.192157 When i use php to read file by code:
6
13733
by: Chad Crowder | last post by:
Getting the following error on my production server whether the file exists or not: "System.IO.IOException: Cannot create a file when that file already exists." Here's the code generating the error (seems to be happening when I try creating a directory) If dirmgr.Exists("s:\blah\" & txt_name.Text) Then lblerror.Text = lblerror.Text & "Unable to build physical path. " &
4
9724
by: lcifers | last post by:
Is there a way, through VB.NET, to determine if the user has selected this option? I am writing an application that does some string functions to rename files, and the file names get chopped up if the expected extension is not returned. I can write another function to get around this, but if there is a clean way to determine the state of that toggle I would rather do that. I may need this again in the future and don't want to always...
34
2817
by: Ross Reyes | last post by:
HI - Sorry for maybe a too simple a question but I googled and also checked my reference O'Reilly Learning Python book and I did not find a satisfactory answer. When I use readlines, what happens if the number of lines is huge? I have a very big file (4GB) I want to read in, but I'm sure there must be some limitation to readlines and I'd like to know how it is handled by python. I am using it like this:
3
2934
by: akang2005 | last post by:
When I write 'double' data to the file, it seems working fine, but when I read it later, it returns a eof when it encounters a particular number even the file is not at the end yet. However, while I write a different set of data, there is no problem to read it. Attached is the file: try change the #define RANGE 1000 into 10000, the code works when the number is 1000, and does not work when the number is 10000.
3
2367
by: Richard Rudie | last post by:
Anyone know of a proper .NET way to get the state of the user's "hide extensions for known file types" setting? Or should I read the value from the Registry directly (HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\HideFileExt)?
13
10733
by: writeson | last post by:
Hi all, I'm writing some code that monitors a directory for the appearance of files from a workflow. When those files appear I write a command file to a device that tells the device how to process the file. The appearance of the command file triggers the device to grab the original file. My problem is I don't want to write the command file to the device until the original file from the workflow has been copied completely. Since these...
0
1071
by: Salim Zaabi | last post by:
Hi I have been trying and searching for good source to the following: registering a new file extension and associating it with an icon, and when double click on the file with new extension an application will pop-up. Please help
0
9541
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10485
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10231
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9073
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7565
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3759
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.