FileCopy Fails accessing Source file

G

Guest

Hi All, I'm experiencing troubles in a simple .net web application. The
applicatione is made up by a single form looping to move some files to a
different folder .

the main loop is as follows :
C
Const CurrUploadDir= .....
Const CurrSentDir= .....
Dim CurFile as string
CurFile = Dir(CurrUploadDir & "*.*")
Do While CurFile <> ""
If Not (GetAttr(CurrUploadDir & CurFile) And vbDirectory) =
vbDirectory Then
..... missing instructions
FileCopy(CurrUploadDir & CurFile, CurrSentDir & CurFile)
Kill(CurrUploadDir & CurFile)
..... missing instruction
End If
CurFile = Dir()
Wend


The copy Statement fails because the Source file "is being used by another
process"

None of the missing instruction works on the Source File of the copy
statement.

The same operation succeeds if performed from the SysOp prompt or from the
Explorer GUI

Monitoring the file activity during debug with a tool from Sysinternals I
cannot see processes other aspnet_wp accessing the file. ..

The following lines relate to the FILECOPY instruction execution .... they
reveals an ACCESS SHARING VIOLATION probably because the first OPEN has not
been closed when the second starts ...

17.12.32 aspnet_wp.exe:776 OPEN SUCCESS Options: Open
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 OPEN SHARING VIOLATION
17.12.32 aspnet_wp.exe:776 OPEN SHARING VIOLATION
17.12.32 aspnet_wp.exe:776 OPEN SHARING VIOLATION
17.12.32 aspnet_wp.exe:776 CLOSE SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS

Where m'I wrong ? How can I detect who is locking the file ? Any suggestion
will be appreciated . Thanks in advance Daniele Balducci
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top