Check if file is overwritten

  • Thread starter Esben Skov Pedersen
  • Start date
E

Esben Skov Pedersen

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
 
L

Larry Bates

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,201
Messages
2,571,053
Members
47,656
Latest member
rickwatson

Latest Threads

Top