473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

FileCopy Fails accessing Source file

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
Feb 22 '06 #1
0 1279

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

36
by: Thomas | last post by:
after spending countless hours trying, i give up and hope to get some help in here. on server1 i got the web myweb.com with my test.asp. in the test.asp, i'm trying to read a file from an UNC...
6
by: deko | last post by:
In a multi-user environment, I have a table that stores hyperlinks to documents that are stored on the machine that hosts the mdb database. The table entry looks like this: ...
9
by: cantelow | last post by:
Hi. I've got a program printing multiple pdf reports, and I need to wait for completion of various associated operations- The pdf printer prints to one file, then I need to copy that where I need...
10
by: BLiTZWiNG | last post by:
When I try the following: System.IO.File.Copy("C:\\test_read\\test.txt", "\\\\192.168.0.5\\test_write\\test.txt", false) I get an UnauthorizedAccessException. I cannot however, seem to find...
8
by: VB Programmer | last post by:
I would appreciate your assistance on this ASP.NET 2.0 site.... This is the wierd problem: While accessing the built in .NET functions for 'profiling' or 'membership' an error is generated (see...
0
by: reidarT | last post by:
I have a project with an installfile-folder with files. I want to copy files from this folder to another location like Sorce = "InstallFiles\file.txt" Destination="c:\...\file.txt" FileCopy...
0
by: kkos | last post by:
I noticed the following issue posted as a double-hop issue in many discussion boards but found no answers that explain how to pass the second hop with windows auth from IIS ASPX page to remote SQL...
16
by: Hans Fredrik Nordhaug | last post by:
I'm trying to write to a file in the current directory - no remote files. The subject says it all - I can add that both the directory and the file is wordwritable. This happens on a (quite good)...
7
by: bhughes2187 | last post by:
In my app I am creating, there is a procedure that does a file copy from the local drive to a network share. The issue I am having, is even though I have the share mapped, and I can browse to the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.