[
  {
    "Id": "954688",
    "ThreadId": "406429",
    "Html": "\r\n<p>Hi, i've developed my own application to compress a large number of files from a directory, but the problem is that i need to delete the original files AFTER the filling into my new zip file.</p>\r\n<p>I wrote a method to compress all files and then to looping all the files into my directories and try to delete them, but... it's not possible because the files are busy from another process...</p>\r\n<p>I'm getting crazy, could someone help me?</p>\r\n<p>In this application it's not possible to close the application to delete the files, i need to delete them during the application running.</p>\r\n<div style=\"color:black; background-color:white\">\r\n<pre><span style=\"color:blue\">using</span> (ZipFile myZip = <span style=\"color:blue\">new</span> ZipFile())\n            {\n                <span style=\"color:blue\">try</span>\n                {\n                    myZip.AddFiles(files);\n                    totalFilesProcessed = files.Length;\n\n                    myZip.Save(_dirBackup &#43; <span style=\"color:#a31515\">&quot;\\\\&quot; &#43; _fileBackupName &#43; &quot;</span>.zip&quot;);\n                }\n                <span style=\"color:blue\">catch</span> (Exception exc) { Console.WriteLine(exc.Message); }\n                <span style=\"color:blue\">finally</span>\n                { \n                    myZip.Dispose();\n                    <span style=\"color:green\">// deleteFiles();</span>\n                }\n            }\n</pre>\r\n</div>\r\n<p>&nbsp;</p>\r\n<p>in my deleteFiles() method i receve an exception that the files are in use by another process....</p>\r\n<p>Thanks for any ideas.</p>\r\n<p>Emanuele</p>\r\n",
    "PostedDate": "2012-12-11T09:53:29.367-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "955029",
    "ThreadId": "406429",
    "Html": "\r\n<p>Hello,</p>\r\n<p>&nbsp;</p>\r\n<p>Try to run the delete command after the using clause: </p>\r\n<div style=\"color:black; background-color:white\">\r\n<pre><span style=\"color:blue\">using</span>(...)\r\n{\r\n...\r\n}\r\nDeleteAllFiles();</pre>\r\n</div>\r\n<p></p>\r\n<p>&nbsp;</p>\r\n<p>Best regards,</p>\r\n<p>Silviu.</p>\r\n",
    "PostedDate": "2012-12-12T02:56:23.6-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]