Quote:
Originally Posted by zybernau
hi,
i am trying to copy files in a loop
while copying at some time, IO exception is thrown
this is the error message thrown
---------------------------
Copy Maestro
---------------------------
File Copy Failed:The process cannot access the file 'C:\Documents and Settings\Admin\Desktop\test grounds\fold1\etst2.dll' because it is being used by another process.
---------------------------
OK
---------------------------
the code,
-
foreach (string key in htFilePath.Keys)
-
{ strFromFile = ((htFilePath[key]) as Filex).FilePathSource;
-
strDestFile = ((htFilePath[key]) as Filex).FilePathDest + "\\" + ((htFilePath[key]) as Filex).FileName;
-
ResetFileAttribute(strDestFile); File.Copy(strFromFile, strDestFile, true);
-
if (blnIncPDB)
-
{ strFromFile = strFromFile.Replace(".dll", ".pdb");
-
strDestFile = strDestFile.Replace(".dll", ".pdb");
-
ResetFileAttribute(strDestFile); File.Copy(strFromFile, strDestFile, true);
-
} ((htFilePath[key]) as Filex).FileStatus = "Copied"; }