473,805 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Does the file REALLY exist

I'm looking at a directory into which files will be copied asyncronously by a
user. If a file takes some time to copy, it is possible to detect the file
before the copy has finished. If I try to process the file, an exception is
thrown. How can I determine if the file is REALLY there and ready to be
processed?

Thanks in advance,
Tom Costanza MCP
Mar 24 '06 #1
2 1100
Attempt to open the file with a lock for exclusive access.

If the file copy has not yet finished then your operation will throw an
exception.
"Tom Costanza" <ma*****@hotmai l.com> wrote in message
news:BA******** *************** ***********@mic rosoft.com...
I'm looking at a directory into which files will be copied asyncronously
by a
user. If a file takes some time to copy, it is possible to detect the
file
before the copy has finished. If I try to process the file, an exception
is
thrown. How can I determine if the file is REALLY there and ready to be
processed?

Thanks in advance,
Tom Costanza MCP

Mar 24 '06 #2
Hi!

I always try first to rename the file.

Wolfgang

"Tom Costanza" <ma*****@hotmai l.com> schrieb im Newsbeitrag
news:BA******** *************** ***********@mic rosoft.com...
I'm looking at a directory into which files will be copied asyncronously
by a
user. If a file takes some time to copy, it is possible to detect the
file
before the copy has finished. If I try to process the file, an exception
is
thrown. How can I determine if the file is REALLY there and ready to be
processed?

Thanks in advance,
Tom Costanza MCP

Mar 24 '06 #3

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

Similar topics

9
2327
by: ben | last post by:
Hello, This really drives me nuts. Im opening an input file, and Im testing if it was open successfully. Thats it! I know that the file that Im trying to open DOES NOT exist but Im getting NO error message. No matter what name I enter I get 'file opened successfully" Any clues? Thanks!
2
3511
by: Steven T. Hatton | last post by:
I'm still not completely sure what's going on with C++ I/O regarding the extractors and inserters. The following document seems a bit inconsistent: http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#1 Copying a file: WRONG WAY: #include <fstream> std::ifstream IN ("input_file"); std::ofstream OUT ("output_file");
2
5920
by: mal hit | last post by:
We developed an ASP.NET application on Windows 2000/SQL Server 2000/IIS 5.0. Recently, we moved the SQL Server 2000 database to Windows 2003. Now, we are unable to connect to the database (on Windows 2003 Standard Ed.) via ASP.NET code on Windows 2000 Standard Ed. The error we get is: SQL Server does not exist or access denied. The SQL Server very much exists on Win 2003. We are able to connect to it remotely via every known manner (SQL...
0
2669
by: Dirk Försterling | last post by:
Hi all, a few days ago, I upgraded from PostgreSQL 7.2.1 to 7.4, following the instructions in the INSTALL file, including dump and restore. All this worked fine without any error (message). Since then, I found lots of the following in the postmaster output: 2003-11-29 15:19:54 ERROR: large object 4838779 does not exist 2003-11-29 15:20:11 ERROR: large object 4838779 does not exist
11
5372
by: Nick | last post by:
This is really starting to piss me off. Someone please prove me wrong. Here is a link to the function in DX 9 sdk. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/d3dx/functions/texture/d3dxsavesurfacetofile.asp Following dll's are referenced in my program. Microsoft.DirectX.dll Microsoft.DirectX.Direct3D.dll Microsoft.DirectX.Direct3DX.dll
16
4990
by: lawrence k | last post by:
I've a file upload script on my site. I just now used it to upload a small text document (10k). Everything worked fine. Then I tried to upload a 5.3 meg Quicktime video. Didn't work. I've set the POST limit in php.ini to 8 megs. What reasons, other than the POST limit, would a large upload fail?
3
4416
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here really understand how this could be an issue. The assemblies that the system is complaining about are ones that we build here and we're not changing version numbers on anything. The errors come and go with no apparent rhyme or reason. We do not...
4
2070
by: SteveW | last post by:
Thanks to some good help from a previous post, I have been able to create well formed xml as part of a report logger app. However, I still have a small problem. When I add new xml to the log file, the new nodes are appended to the original file. What I really want is for the log file to grow as "report nodes" are added. Also, I am a bit concerned about performance, particularly as the file grows in size. I must write to an xml file (vs. a...
3
323
by: Mike | last post by:
Thanks for the reply, I have been trying that, but I keep getting the same results. The result I get is that the file exits, when it really doesn't. All my msgbox display twice and I'm not sure why. Here is the code I'm using. Can you help? Public Const fnet As String = "\\server1\images" Public pfile As String = "TEST01.TXT" Private Sub DoesExist() If System.IO.File.Exists(fnet & "\" & pfile) Then
19
4213
by: Angus | last post by:
I have a socket class CTestClientSocket which I am using to simulate load testing. I create multiple instances of the client like this: for (int i = 0; i < 5; i++) { CTestClientSocket* pTemp = new CTestClientSocket(this, ip, port); pTemp->Connect(); m_collClients.push_back(pTemp);
0
9718
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10617
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10364
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10370
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9186
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4328
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.