File.Move Execution Pauses

M

Mattbooty

If this is the wrong forum I apologize and please point me in the
right direction.

I have a program where users can drag files from the file system and
drop them onto a list view. When the file is dropped my program 1)
moves the file to a directory specified within the application, 2)
looks at the file and databases some parts of it, 3) renames the file
based on information pulled in part 2.

the problem I'm seeing is that when i call File.Move(src,dst) the file
never actually moves until all processing completes so when i try to
rename the file (using another file.move) i get an error that the file
is in use. If I step through the code, I can watch the file in the
source directory and it never moves until ALL processing completes.
The same thing happens with file.copy. With file.copy the file does
get copied to the new location but it is still marked as locked from
the copy operation (plus the file copy adds a lot of time to the whole
process).

Is there any way to force the move to complete immediately... and then
to pause my program until the move finishes? I tried doevents, i
tried sleep, but the move operation just waited with the rest of the
program.

I'm running in VB.NET 2008. Any help would be a lifesaver
 
M

Mattbooty

I Also want to note that I'm not positive as to whether its actually
the move that is causing the rename not to run, or if its the drag
drop operation that is causing the initial move to pause, which in
turn causes the rename to error out.
 
F

Family Tree Mike

In step 2, how or which location, do you open the file to read and proces
with the database? That process would seem to need to open the file. Is it
locking the file?
 
M

Mattbooty

In step 2, how or which location, do you open the file to read and proces
with the database?  That process would seem to need to open the file.  Is it
locking the file?


I found the problem, it was not the move after all. One of the
operations I was performing on the file was a file hash and i wasn't
properly cleaning up after myself.

Thanks for the help.
 

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

Similar Threads


Top