Hello,
I have a FileSystemWatch er looking at a particular directory. When I copy a
large file (750 MB) to this directory I receive multiple Change events. I am
fine with this but when I call File.GetLastWri teTime in the Change event it
returns the current date and time not the date and time windows explorer
shows as Last Write Time. If the file is small everything works fine. Is
there a way to fix this issue?
Thanks,
Ken 3 3631
Hi,
"Kenneth H. Brannigan" <Kenneth H. Br*******@discu ssions.microsof t.com>
wrote in message news:8C******** *************** ***********@mic rosoft.com... Hello, I have a FileSystemWatch er looking at a particular directory. When I copy a large file (750 MB) to this directory I receive multiple Change events. I am fine with this but when I call File.GetLastWri teTime in the Change event it returns the current date and time not the date and time windows explorer shows as Last Write Time. If the file is small everything works fine. Is there a way to fix this issue?
The FilesystemWatch er is far from be an exact science. Probably you get
that time cause the file still is being changed (or open to write).
Unfortunately there is no CloseFile event, so you dont know when the file
was closed.
If the file is small probably what is happening is that the file is closed
already by the time you handle the LastWrite event.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Hello,
Any suggestions on a work around? Is there something beside the
fileSystemWatch er that should be utilized. Anyway to determine when the file
is finished with the copy process?
Thanks,
Ken
"Ignacio Machin ( .NET/ C# MVP )" wrote: Hi,
"Kenneth H. Brannigan" <Kenneth H. Br*******@discu ssions.microsof t.com> wrote in message news:8C******** *************** ***********@mic rosoft.com... Hello, I have a FileSystemWatch er looking at a particular directory. When I copy a large file (750 MB) to this directory I receive multiple Change events. I am fine with this but when I call File.GetLastWri teTime in the Change event it returns the current date and time not the date and time windows explorer shows as Last Write Time. If the file is small everything works fine. Is there a way to fix this issue?
The FilesystemWatch er is far from be an exact science. Probably you get that time cause the file still is being changed (or open to write). Unfortunately there is no CloseFile event, so you dont know when the file was closed.
If the file is small probably what is happening is that the file is closed already by the time you handle the LastWrite event. -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
Hi,
Well if you program itself copy the file you can rise an event when the file
is copied completely.
Other than that, I do not think you have a way.
A dirty solution could be trying to open the file for write, as it's open by
another process you should get an exception, you put this in a timer and you
are done.
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Kenneth H. Brannigan" <Ke************ ***@discussions .microsoft.com> wrote
in message news:A2******** *************** ***********@mic rosoft.com... Hello, Any suggestions on a work around? Is there something beside the fileSystemWatch er that should be utilized. Anyway to determine when the file is finished with the copy process? Thanks, Ken
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,
"Kenneth H. Brannigan" <Kenneth H. Br*******@discu ssions.microsof t.com> wrote in message news:8C******** *************** ***********@mic rosoft.com... > Hello, > I have a FileSystemWatch er looking at a particular directory. When I > copy > a > large file (750 MB) to this directory I receive multiple Change events. > I > am > fine with this but when I call File.GetLastWri teTime in the Change > event > it > returns the current date and time not the date and time windows > explorer > shows as Last Write Time. If the file is small everything works fine. > Is > there a way to fix this issue?
The FilesystemWatch er is far from be an exact science. Probably you get that time cause the file still is being changed (or open to write). Unfortunately there is no CloseFile event, so you dont know when the file was closed.
If the file is small probably what is happening is that the file is closed already by the time you handle the LastWrite event. -- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Josh Usovsky |
last post by:
I'm setting up a watched folder using FileSystemWatcher.
When I drop a small file into the watched folder, I can
respond to a .Created event and process the file with
other code. However, if I try copying a large file into
the watched folder, the .Created event is fired off
immediately and not when the file is finished copying. I
have tried waiting for a certain number of .Changed
events to be fired after the initial .Created event, and...
|
by: Trowa |
last post by:
Hi,
I'm trying to use FileSystemWatcher to determine when a new file has been
added to a directory. However, after the file has been added, I need to
process the file. This results in a problem if the file is large and takes
time to copy, as the events appear to get received before the copy is
finished.
I've tried listening to the Created event, as well as the Changed event
(which gets fired multiple times) based on the last write...
|
by: Steel City Phantom |
last post by:
i am building a content distribution system using the filesystemwatcher
to catch people moving files in and out of the system and update a
database. what happens is when a process runs that moves hundreds of
files (happens every day) i get all kinds of debug errors and an
unhandled exception. here is the debug log
First-chance exception at 0x7c342eee (msvcr71.dll) in VoiceScanner.exe:
0xC0000005: Access violation reading location...
|
by: John Lee |
last post by:
Hi,
I wrote a small program that copy a list of files to a specified folder one
by one, i.e. this app will copy one file into the specified folder and wait
until it's consumed (deleted) then copy another one in. Here is what my
code:
// other codes to get a list of files
while (morefiles)
{
|
by: Phil396 |
last post by:
I have a windows service that uses a filesystemwatcher
to wait for files and process them to a database.
Sometimes a large group of files will be cut and paste
for the filesystemwatcher to process. I ran into
trouble when trying to process a group of files
at a time.
The code below fixed my problem for about 15 large files
( around 100k each ). However when I tried to use it
on a group of small files ( 90 files ) it crashes (
around 6k...
| |
by: Megan |
last post by:
I have a windows service that monitors a folder. I have a
routine to process XML files whenever a new file gets
created (in the folder that the Filesystemwatcher is
monitoring.)
Since the files are large, before the copy process is
completed the Created event fires first, and I get errors
because I'm trying to read the xml file on to a stream
for further process.
The Created event gets raised when I copy and paste a new
xml file onto...
|
by: Mahita |
last post by:
Hi,
I am coding a Windows Service in which I am using the "OnCreated" event of
FileSystemWatcher class to do some processing when a new file is created in a
particular folder. However I have encountered the following issue in the
"OnCreated" event of FileSystemWatcher class.
Whenever a file is copied from a different folder (like network share) and
pasted to the monitoring folder and this copy & paste process takes time,
even before the...
|
by: somequestion |
last post by:
Hi,
I'm trying to use FileSystemWatcher to determine when a new file has been
added to a directory. However, after the file has been added, I need to
process the file. This results in a problem if the file is large and takes
time to copy, as the events appear to get received before the copy is
finished.
I've tried listening to the Created event, as well as the Changed event
(which gets fired multiple times) based on the last write time....
|
by: D2 |
last post by:
Hi,
I have this problem when working with FileSystemWatcher class. I m
using one of these objects to watch over a folder. Whenever i big file
from another folder to the folder being watched, I get created event
and multiple changed events.
After the file is copied (fully) i want to read the file and perform
some operations on it. Now the issue is, there is no way to find that
the file has been copied entirely.
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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...
|
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,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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...
| |