473,461 Members | 1,099 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Check if file is overwritten

How do i check if a file is overwritten by another program, while my script
is running?

I have to monitor changes and act on them on the fly.

It only has to work on windows, so perhaps it is possible to set op a hook
to the system. I saw that done on a folder at one time, but i can't find
the example now.

I would rather that it uses a minimum of CPU, since the program always will
be running. Does anybody know the solution?

/Esben
Jul 18 '05 #1
1 1773
When you open file, get last modified date
using os.path.getmtime() and set it aside.
When you are done with the file, get the
os.path.getmtime() again again, if it has
changed you will know it.

HTH,
Larry Bates
Syscon, Inc.

"Esben Skov Pedersen" <sp**@geek.linux.dk> wrote in message
news:Xn*******************************@130.225.247 .90...
How do i check if a file is overwritten by another program, while my script is running?

I have to monitor changes and act on them on the fly.

It only has to work on windows, so perhaps it is possible to set op a hook
to the system. I saw that done on a folder at one time, but i can't find
the example now.

I would rather that it uses a minimum of CPU, since the program always will be running. Does anybody know the solution?

/Esben

Jul 18 '05 #2

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

Similar topics

6
by: Pekka Niiranen | last post by:
Hi, I have used the following example from win32 extensions: -----SCRIPT STARTS---- import win32file import win32con import win32security import pywintypes
9
by: Jon LaBadie | last post by:
Suppose I'm using stdio calls to write to a disk file. One possible error condition is no space on file system or even (in unix environment) a ulimit of 0 bytes. Which calls would be expected to...
0
by: Gawel | last post by:
I inserted some data to the resource file that is assiciated with every Web Form. Then I made same changes in layout (added controls) and saved project. At this moment my data in resource file was...
3
by: noridotjabi | last post by:
Say I'm writting a program. In this program for some reason I need to store data somewere were I will be able to access it again. I don't want to store it in a file because then it could be...
3
by: Kat | last post by:
Ok my problem with this program is that currently it isn't overwriting a dummy TXT file I have set up to test the program. At one point it did however so I know it should work but now, for some...
5
by: Paolo | last post by:
Hi all! I have to create an application that receive some packet from an interface and builds a file from those. In the header there are three fields: one is the total lenght of the file, one is...
6
by: Zytan | last post by:
I ran through the VB Guided Tour some time ago. In particular, the "Managing Your Records: Using Data in Your Program" section: http://msdn2.microsoft.com/en-us/library/t25kbx0s(VS.80).aspx ...
10
by: Cliff72 | last post by:
Is there a way in VBA to check if a linked table in the database has been updated? Example: I have a table "LedgerTemp" which is a direct link to a text file on the LAN "Ledger.txt" This text...
3
by: stonefunker | last post by:
I've been playing around with the concept of wiping files from a thumbdrive and it seems to be working pretty well. I have the code below and the file seems to be overwritten as they should. I...
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
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...
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,...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...
0
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 ...

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.