System.IO.File.Move

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

why does System.IO.File.Move("c:\\hmbug.jpg", "c:\\foodoo\\foo.jpg"); throw
access denied? im just moving a file in a console app? any ideas?
 
Hi Daniel,

Does the destination file already exist? Is some other program accessing hmbug.jpg (might well be one of your own previous compilation which is still running).

If the target file already exists you need to delete it first.

if(File.Exists("c:\\foodoo\\foo.jpg"))
File.Delete("c:\\foodoo\\foo.jpg");
 
Back
Top