File.Move problems

  • Thread starter Thread starter Franz
  • Start date Start date
F

Franz

// The following is just one of the pieces of code inside my program.
string strOldFilePath = @"C:\Project\ABC.jpg";
string strNewFilePath = @"C:\Project\Image\ABC.jpg";
File.Move(strOldFilePath, strNewFilePath);

When I execute the File.Move method, it told me that "The process cannot
access the file C:\Project\Image\ABC.jpg, because it is being used by
another process". However, there is no ABC.jpg inside C:\Project\Image\.
This file will be created only after the File.Move method. The file doesn't
exist, so how is it used by another process? In addition, there is only one
process which accesses C:\Project\ABC.jpg and I call Image.Dispose method
before I call File.Move. I don't know why this problem occurs. Can anyone
help me?
 
Back
Top