I want to copy a folder, and i want to delete destination folder first. So I am deleting destination folder then recreate it and then copy files. The problem is that i get the <
I am confused about your current solution. GC has nothing to do with deleting a folder, it only works because adding GC related functionality there is similar to adding Thread.Sleep() or a MessageBox. It works only by chance.
Instead, you should wait until the directory is actually deleted, e.g:
Directory.Delete(destFolder, true); // delete folder
while(Directory.Exists(destFolder))
{
Thread.Sleep(100);
}
Only once this code finishes, you should continue.