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

Process cannot access the file

Hello All

I created a utility that uses the File System Watcher and then once the File
is copied to the Watch Directory my utility parses the file then moves the
files to a set directory.

The Problem is that I am using a Anti-Virus Software on my server since I am
coping allot of files to the watch directory the Anti Virus Scans the
directory and locks my files from being Moved.

So My Question Is ?
Is there a way to determine if a Process is on a File wait till that process
is complete and then perform my coping method on the given file.



Nov 20 '05 #1
7 1634
* "Stuart Shay" <ss***@j51.com> scripsit:
I created a utility that uses the File System Watcher and then once the File
is copied to the Watch Directory my utility parses the file then moves the
files to a set directory.

The Problem is that I am using a Anti-Virus Software on my server since I am
coping allot of files to the watch directory the Anti Virus Scans the
directory and locks my files from being Moved.

So My Question Is ?
Is there a way to determine if a Process is on a File wait till that process
is complete and then perform my coping method on the given file.


AFAIS no -- you will have to try to move the file until it can be moved.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
* "Stuart Shay" <ss***@j51.com> scripsit:
I created a utility that uses the File System Watcher and then once the File
is copied to the Watch Directory my utility parses the file then moves the
files to a set directory.

The Problem is that I am using a Anti-Virus Software on my server since I am
coping allot of files to the watch directory the Anti Virus Scans the
directory and locks my files from being Moved.

So My Question Is ?
Is there a way to determine if a Process is on a File wait till that process
is complete and then perform my coping method on the given file.


AFAIS no -- you will have to try to move the file until it can be moved.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
Hi Herfried,

AFAIS no -- you will have to try to move the file until it can be moved.


This is an indirect answer to the OP, what is wrong setting it than in a
timer and Try it again after a while or creating a list with the files which
where locked and do them at the end?

And then your answer is AFAIS yes in my opinion. Or do I understand AFAIS
wrong?

However when you tell this cannot be done, than tell that?

Cor
Nov 20 '05 #4
Hi Herfried,

AFAIS no -- you will have to try to move the file until it can be moved.


This is an indirect answer to the OP, what is wrong setting it than in a
timer and Try it again after a while or creating a list with the files which
where locked and do them at the end?

And then your answer is AFAIS yes in my opinion. Or do I understand AFAIS
wrong?

However when you tell this cannot be done, than tell that?

Cor
Nov 20 '05 #5
* "Cor Ligthert" <no**********@planet.nl> scripsit:
AFAIS no -- you will have to try to move the file until it can be moved.
This is an indirect answer to the OP, what is wrong setting it than in a
timer and Try it again after a while or creating a list with the files which
where locked and do them at the end?


Yep -- that's the approach I would follow.
And then your answer is AFAIS yes in my opinion. Or do I understand AFAIS
wrong?

However when you tell this cannot be done, than tell that?


AFAIS = "As Far As I See".

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6
* "Cor Ligthert" <no**********@planet.nl> scripsit:
AFAIS no -- you will have to try to move the file until it can be moved.
This is an indirect answer to the OP, what is wrong setting it than in a
timer and Try it again after a while or creating a list with the files which
where locked and do them at the end?


Yep -- that's the approach I would follow.
And then your answer is AFAIS yes in my opinion. Or do I understand AFAIS
wrong?

However when you tell this cannot be done, than tell that?


AFAIS = "As Far As I See".

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #7
Thanks for the Response, I decided that if I add a 1sec delay before I move
the file the Anti Virus Scan will be completed before it is time to process
the file being scaned.

Thread.Sleep(1000)

If anyone can give me a better solution to determine if the file is being
used by another process before I move it would be appreciated.

Thanks
Stuart



"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c5***********@ID-208219.news.uni-berlin.de...
* "Cor Ligthert" <no**********@planet.nl> scripsit:
AFAIS no -- you will have to try to move the file until it can be moved.


This is an indirect answer to the OP, what is wrong setting it than in a
timer and Try it again after a while or creating a list with the files
which
where locked and do them at the end?


Yep -- that's the approach I would follow.
And then your answer is AFAIS yes in my opinion. Or do I understand AFAIS
wrong?

However when you tell this cannot be done, than tell that?


AFAIS = "As Far As I See".

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #8

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

Similar topics

9
by: Paul | last post by:
Hi, VB.NET is saying the file I am creating is in use by another process and won't complete its task of moving the file to the specified destination folder. Here is my code (the main bit...
4
by: Mountain Bikn' Guy | last post by:
I am having serious problems with the following IDE bug: Could not write to output file 'x.dll' -- 'The process cannot access the file because it is being used by another process. ' and BUG:...
3
by: trellow | last post by:
Hello, I am writing an application that needs to read a file that is already open by another process for writing. When I do the following: FileStream fs = new FileStream(fileName,...
2
by: Raed Sawalha | last post by:
Hello , I have windows service which do listening to specified directory using FileSystemWatcher , on Created Event and Get all the files in the directory using Directory.GetFiles function then...
3
by: guoqi zheng | last post by:
Dear sir, There is an import tool on my web application, user can upload Ms Access file, the file is saved at a temp folder on the server. After the import is finished, for security reason, I...
0
by: Sin | last post by:
> Xxxxx : error PRJ0008 : Could not delete file 'd:\xxxxxxx.dll'. > Make sure that the file is not open by another process and is not write-protected. > > LINK : fatal error LNK1168: cannot open...
5
by: ZWeng | last post by:
I created a windows service using FileSystemWatcher to moniter a folder for file drops. The service uses FileStream and StreamReader to read and process the file. After it is done, the file is...
0
by: imranabdulaziz | last post by:
Dear All, I am making web application using Asp.net C#(Visual Studio2005). And Sql server 2005 as a back End I generated local mode report but as there was no printing option available . I assign...
0
nightangel
by: nightangel | last post by:
Hi dude,what i was done in my application is uploading a image file to my server using FTP, it work great when pushing a file into the server path using FTP. The problem i met now is i need to do a...
4
by: =?Utf-8?B?VkIgSm9ubmll?= | last post by:
I am at my witless end here, please help! I have an ASP.Net aspx web page, hosted on Windows Server 2003, that receives a query string with the path to an autocad drawing file selected from a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
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.