3

I am using chilkat library for zipping some files and moving them to a another path. This works fine most of the time, but some times there is a tmp file made in path where my exe resides. Now I checked suddenly after 3 months,this files has gone to take 2 GB of hard disk. Following is my code:

 public static bool MoveShopTRRFiles() {
            //string fullfilepath;
            Zip zip = new Zip();
            bool unlocked = zip.UnlockComponent("abc");
            if (!unlocked) {
                //MessageBox.Show(zip.LastErrorText);
                //return;
                return false;
            }
            if (Directory.Exists(_TRRPath)) {
            foreach (string filename in Directory.GetFiles(_TRRPath, "*.trr")) {
                if (!File.Exists(_ShopTRRPath + "\\" + GetShopName(filename) + ".zip")) {
                    zip.NewZip(_ShopTRRPath + "\\" + GetShopName(filename) + ".zip");
                } else {
                    zip.OpenZip(_ShopTRRPath + "\\" + GetShopName(filename) + ".zip");
                }
                try {
                    if(zip.GetEntryByName (filename.Substring(filename.LastIndexOf('\\') + 4))==null ){
                        zip.AppendOneFileOrDir(filename);
                    }

                    zip.WriteZipAndClose();                       
                    File.Delete(filename);
                } catch {

                }
            }
            return true;
        } else
            return false;
    }
Pradeep
  • 3,258
  • 1
  • 23
  • 36
Sunil Sharma
  • 782
  • 1
  • 10
  • 22
  • Writing to the exe path is probably unacceptable if you want this program to install in a UAC environment. – spender Mar 24 '11 at 14:51
  • just wanted to know if is it chilkat which makes this temporary files in the executable path.this code runs as a scheculed task with interval of 30 seconds – Sunil Sharma Mar 24 '11 at 15:48

1 Answers1

0

FOr now,i am deleting the temp files if any from the application folder.So this solves the problem for now.

Sunil Sharma
  • 782
  • 1
  • 10
  • 22