The process cannot access the file because it is being used by another process!

V

varlagas

I am attempting to programmatically back up files lying in a folder in
a Windows 2000 machine, by way of Java (Apache Commons/Net library).
The Java code runs on a remote server (actually an AS/400 one) and
accesses the Win2K machine, attempting to (i) copy the files to a
backup folder on the Win2K machine and (ii) delete the original files.
When the program merely copies or merely deletes the files, it works
fine. However, if it first copies the files and subsequently attempts
to delete them, deletion fails with a 550 FTP error:

"The process cannot access the file because it is being used by another
process."

Running the "handle" utility on the target machine I got the following:

===============================================================================

Handle v3.2
Copyright (C) 1997-2006 Mark Russinovich
Sysinternals - www.sysinternals.com

------------------------------------------------------------------------------
System pid: 8 NT AUTHORITY\SYSTEM
[...]
3C8: File (RW-) C:\Inetpub\ftproot\data_efu_in\INTER777

===============================================================================

(INTER777 is the file to be deleted.)

Does anyone have a clue as to why this handle is held on the file, long
after the copy file operation has
been completed? It is this lock held that apparently prevents file
deletion and results in a 550 error.... What should I do to overcome
this problem? Thx!
 

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