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

Using ST_ATIME to watch for files being read

I need to monitor a bunch of files to see what is being opened, read,
and closed, with no modifications being made. This is being done
first on Windows machines, and later on Solaris.

Looking through Python Programming on Win32, I saw the ST_ATIME (page
311) which looked promising, but when I did a little test, the results
weren't good (read: sucked):

# from the i.shell. st_atime date is inside >>><<<
os.stat("c:\\devtemp\\python\\1.txt") (33206, 0L, 2, 1, 0, 0, 3L, >>>1080919329<<<, 1080919329, 1080918583)

# now i open c:\devtemp\python\1.txt, close it, and rerun os.stat("c:\\devtemp\\python\\1.txt")

(33206, 0L, 2, 1, 0, 0, 3L, >>>1080919329<<<, 1080919329, 1080918583)

The Win32 books states that stat.ST_ATIME is "the time the file was
last accessed or zero if the filesystem doesn't support this
information". Obviously I'm missing something, or maybe atime isn't
the best thing for me to use in this situation. Hoping someone can
provide guidance.

TIA
-cjl
Jul 18 '05 #1
1 2370
On 2 Apr 2004 07:39:38 -0800, rumours say that ia*******@hotmail.com
(Chris) might have written:

Hi Chris,
I need to monitor a bunch of files to see what is being opened, read,
and closed, with no modifications being made. This is being done
first on Windows machines, and later on Solaris.
<snip>
# from the i.shell. st_atime date is inside >>><<<
os.stat("c:\\devtemp\\python\\1.txt")(33206, 0L, 2, 1, 0, 0, 3L, >>>1080919329<<<, 1080919329, 1080918583) # now i open c:\devtemp\python\1.txt, close it, and rerun


How exactly do you open the file? Through python or through an external
program (eg notepad)? If only through python, do you read any data? I
believe you have to read data for the access time to be updated.
os.stat("c:\\devtemp\\python\\1.txt")

(33206, 0L, 2, 1, 0, 0, 3L, >>>1080919329<<<, 1080919329, 1080918583)

The Win32 books states that stat.ST_ATIME is "the time the file was
last accessed or zero if the filesystem doesn't support this
information". Obviously I'm missing something, or maybe atime isn't
the best thing for me to use in this situation. Hoping someone can
provide guidance.


Windows has a weird behaviour even with st_mtime... I have a directory
structure in a USB disk, which, taking advantage of NTFS capability for
hard links, I present under two different views for the users of my
network. To avoid re-reading the contents of all files, I keep a cache
of (relative-filename, size, modification time); by comparing the cache
to the actual directory structure, every time I change a couple of
files, I read only the changed ones to decide where in the linked
structures I will present them.

I have found (through trial and error) that the modification time does
not show up immediately, esp. if the file is modified in the linked
directory structures... I tried even using a sync.exe from sysinternals,
but that doesn't change a lot. So, after a change, I wait a couple of
minutes and then I run the python script that relinks the files.
Everything works this way.
--
TZOTZIOY, I speak England very best,
Ils sont fous ces Redmontains! --Harddix
Jul 18 '05 #2

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

Similar topics

3
by: jason | last post by:
Does anyone have any ideas on a PAGE WATCH tool or an application that allows a user to be notified when page changes automatically by email. My immediate thoughts would be to use the FSO object...
1
by: Troy Murphy | last post by:
I seem to remember using a walkthru in the early beta that demonstrated how to create a Windows Service that would monitor events in a folder. Can someone please direct me to an example of doing...
5
by: Mark | last post by:
Hi all, I am trying to execute a batch file to copy over files from one server to another. The batch file is using robocopy to copy over the files. ============ private void CopyFiles() {// Use...
8
by: Sunil Menon | last post by:
Dear All, We are developing applications in ASP.Net...in one of our applications we would like to use a GridControl...we have tried to use a Server-Side Grid control but found the speed to be an...
1
by: batista | last post by:
Hello all, I have a grid that im updating using webservice.htc after every 5 sec. But i read after i used it that webservice.htc has severe memory leak.(my badluck :) ) So, now someone...
5
by: Michael Sperlle | last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems to need changes to the kernel before it can be installed, and I have no intention of going through whatever hell that would...
8
by: ronen.chen | last post by:
I noticed that some sites use <script src='fineName.js?ver=XXX'></script(even google) Someone told me that it's for script changes, means - if the file in server has been changed than the new XXX...
3
by: JDeats | last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting and decrypting a file. http://support.microsoft.com/kb/307010 In .NET 2.0 this approach is not fully supported (a .NET 2.0...
9
by: dgleeson3 | last post by:
Hello All I have a txt file of strings of different lengths. I dont know how many strings are in the file. I have no problem reading the file and sending to the console (as below). To...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.