473,411 Members | 1,880 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,411 software developers and data experts.

Copying FIles Error

I have written a little application which copies files from one location to
another location.
Before it copies the file, it ensure the directory for both the from and to
locations is valid. It also ensures that the from file exists.

All that being successful, it attempts to copy the file, but each time I get
an exception in which the text of the message says "The process can not copy
the file XXXXXXXXX because it is being used by another process."

These files are just sitting on a shared drive and where they are being
copied to is on a shared drive. Not everyone of these files is currently
in-use and I would be surprised if any of the file are in-use by another
application/process/user.

So what is the real error here and what can I do to resolve this issue?

Thanks in advance for your assistance!!!!
Mar 16 '06 #1
6 1957
Jim,

How are you actually copying the files?????

Are you using the System.IO File.Copy method or are you copying the files
bit by bit after opening them internally.

I accidently once wrote a bug into an application that copied files, but
accidently left the file handles open and could not copy the files becuase
they were being accessed by another process, i.e., my application when it
was calculating the actual size of the file.

Regards

Scott Blood
C# Developer

"Jim Heavey" <Ji*******@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...
I have written a little application which copies files from one location to
another location.
Before it copies the file, it ensure the directory for both the from and
to
locations is valid. It also ensures that the from file exists.

All that being successful, it attempts to copy the file, but each time I
get
an exception in which the text of the message says "The process can not
copy
the file XXXXXXXXX because it is being used by another process."

These files are just sitting on a shared drive and where they are being
copied to is on a shared drive. Not everyone of these files is currently
in-use and I would be surprised if any of the file are in-use by another
application/process/user.

So what is the real error here and what can I do to resolve this issue?

Thanks in advance for your assistance!!!!

Mar 16 '06 #2
vj
This sure sounds like a FileHandle being not closed..

VJ

"Jim Heavey" <Ji*******@discussions.microsoft.com> wrote in message
news:19**********************************@microsof t.com...
I have written a little application which copies files from one location to
another location.
Before it copies the file, it ensure the directory for both the from and
to
locations is valid. It also ensures that the from file exists.

All that being successful, it attempts to copy the file, but each time I
get
an exception in which the text of the message says "The process can not
copy
the file XXXXXXXXX because it is being used by another process."

These files are just sitting on a shared drive and where they are being
copied to is on a shared drive. Not everyone of these files is currently
in-use and I would be surprised if any of the file are in-use by another
application/process/user.

So what is the real error here and what can I do to resolve this issue?

Thanks in advance for your assistance!!!!

Mar 16 '06 #3
Yes, I am using the System.IO.File.Copy to copy the files with the OverWrite
options.
Mar 16 '06 #4
My application does not open the files, it only performs the items which I
indicated previously. Check to see if the directory is valid on both the
from and to locations. And then it check the From File name to see if the
file exist. If all of those are true, it jus uses the System.IO.File.Copy
process to copy the file from one location to another with the "overwrite"
option of the copy method.
Mar 16 '06 #5
vj
Oh then... maybe the process that is writing the file is not releasing
handle properly... If your problem is intermittent as you have mentioned

VJ

"Jim Heavey" <Ji*******@discussions.microsoft.com> wrote in message
news:D0**********************************@microsof t.com...
My application does not open the files, it only performs the items which I
indicated previously. Check to see if the directory is valid on both the
from and to locations. And then it check the From File name to see if the
file exist. If all of those are true, it jus uses the System.IO.File.Copy
process to copy the file from one location to another with the "overwrite"
option of the copy method.

Mar 16 '06 #6
Turns out that I was using the same file name for both my from and to file to
copy.
Silly mistake, but atleast now I understand the error message which was
generated.
Mar 16 '06 #7

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

Similar topics

3
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore...
2
by: Cherrish Vaidiyan | last post by:
Hello database professionals, I am thankful for all ur support to me till now. I accept the suggestion given to me by Mr.Frank in case of answering. This query is related to oracle 9i on Red...
0
by: Dan | last post by:
We debug a VB.Net App that uses compact framework to a DAP Windows CE.Net device. When I debug I would like to only have the EXE copied down. Right now it copies any referrences as well and...
0
by: postings | last post by:
Hi I'm a little confused. I've deployed my ASP.NET project by using the "copy project" feature of VS2003. Works fine. I'm stuck however in copying individual files to the deployed solution. ...
5
by: TB | last post by:
Hi All: This news group is proving to be great help on my path towards mastering ASP.NET thanks to all of you helpful souls out there. I am looking forward to the day when I can contribute...
3
by: Walter G | last post by:
I created a a VB.Net application that includes different projects. When copying the files (created when built the solution) from the BIN folder to the application folder (under IIS) I got this...
10
by: Martin Ho | last post by:
I am running into one really big problem. I wrote a script in vb.net to make a copy of folders and subfolder to another destination: - in 'from.txt' I specify which folders to copy - in...
16
by: NoodNutt | last post by:
G'day ppl Is there a process whereby I can copy the text labels of all the files in a root directory? I recall going back a long way seeing something about it but did not take any notice as I...
6
by: Lalit | last post by:
I am new to python. Infact started yesterday and feeling out of place. I need to write a program which would transfer files under one folder structure (there are sub folders) to single folder. Can...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.