September 12, 2010 at 3:32 pm
Hello,
I want to execute the following bit in a stored procedure (which is called through a cursor) to move the files to another location.
EXEC('xp_cmdshell ''move "d:\Prospects\' + @FileName2 + '" "d:\ValidatedFolder"''').
The output I am getting is 'The process cannot access the file because it is being used by another process'.and is not moving any files I want to move to the desired location.
Any help is highly appreciated.
Thanks in advance
September 12, 2010 at 5:10 pm
did your cursor just create the file prior to moving it? it's quite possible that the command to create the file was issued, and the disk sub system is still actually writing the file to disk by the time the next command to move the file is issued.
if you just created it, and are already moving it, why not create it in the final location in the first place? is another process doing something to the file between creation and moving?
Lowell
September 12, 2010 at 10:54 pm
You can find out which process is using that file. An example explained here[/url]
Pradeep Adiga
Blog: sqldbadiaries.com
Twitter: @pradeepadiga
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply