0

I am zipping a folder to a zip file. The problem is, every time it does that, my other applications become slower, especially my chrome.

    static void Main(string[] args)
    {
        string start = Console.ReadLine();
        Thread tryer = new Thread(zipFolder);
        tryer.Priority = ThreadPriority.Lowest;
        tryer.Start(start);
        Console.ReadLine();
    }
    public static void zipFolder(object str2in)
    {
        string tempString = str2in.ToString();
        string[] zipPaths = tempString.Split('|');
        ZipFile.CreateFromDirectory(zipPaths[0], zipPaths[1]);
        Console.WriteLine("ENDED");
    }

As you can see, reducing the priority to the lowest does not help in reducing the disk I/O.

I need a way to reduce the disk I/O to half

Matty2
  • 55
  • 6
  • 1
    The only way I can think of doing that is zipping from a stream and writing a custom stream implementation that throttles the bytes. – James Aug 21 '15 at 14:27
  • Note, you are not slowing down your application only, but **everything** what is trying to access target disk (source disk too if it's different, but zip makes data smaller and writing is slower = writing is bottleneck). E.g. use another physical drive to save resulting zip-file and nothing else should access this disk (obviously). – Sinatr Aug 21 '15 at 14:46

0 Answers0