I am taking a file with a name of sfile
In my method I am doing like this way
File.Copy(sSFile, Failure + "\\" + Path.GetFileName(sSFile)) ''''''''''FAILURE FOLDER"""""
fileCounter += 1
File.move(sSFile, BACKup + "\\" + Path.GetFileName(sSFile)) ''''''''''BACKup FOLDER"""""
fileCounter += 1
where failure and backup are different folders But it iss throw开发者_如何学JAVAing an error : This process is using by some other process
Look at MSDN example. Hope it'll help.
Get the Path First, and then Copy the File, and then do the Same then Move the File.
I am guessing your trying to get the Filename when your already holding on to it to Copy and or Move It.
Use
File.Copy(sSFile, Path.Combine(Failure, Path.GetFileName(sSFile)), bool_overrideflag);
精彩评论