File.Move problems

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top