473,800 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is it possible to detect if files on a drive were changed without scanning the drive?

It is maybe not a pure Python question, but I think
it is the right newsgroup to ask for help, anyway.

After connecting a drive to the system (via USB
or IDE) I would like to be able to see within seconds
if there were changes in the file system of that drive
since last check (250 GB drive with about four million
files on it).

How to accomplish this? (best if providing
directly a Python receipe for it :-)
Do available file systems have something like
archive attribute assigned to the root directory
of the drive?
I suppose not. Am I right?

I ask this question having Microsoft Windows 2000
and Windows proprietary NTFS file system in mind,
but I am also interested to know it about Linux or
Unix file systems.

I know, that looking for the archive attribute of the
top directories doesn't help when the change
happened to files somewhere deeper in the
hierarchy of directories.

Any hints are welcome.

Claudio
Sep 12 '05 #1
8 2135
On Mon, 12 Sep 2005, Claudio Grondi wrote:
It is maybe not a pure Python question, but I think it is the right
newsgroup to ask for help, anyway.
You might try comp.arch.stora ge or comp.sys.ibm.pc .hardware.stora ge, or a
newsgroup specific to the operating system you're working on.
After connecting a drive to the system (via USB or IDE) I would like to
be able to see within seconds if there were changes in the file system
of that drive since last check (250 GB drive with about four million
files on it).

How to accomplish this?


I don't think there's a portable way to do this. I also don't think
there's a way to do this at all on most disks. I think there might be a
way to do this using journalled filesystems, but i'm not certain, it would
definitely involve fiddling with low-level filesystem APIs (or even
on-disk structures), and, UIVMM, these are a minority of disks anyway.

Sorry i couldn't be more helpful!

tom

--
The revolution will not be televised. The revolution will be live.
Sep 12 '05 #2
Claudio Grondi wrote:
After connecting a drive to the system (via USB
or IDE) I would like to be able to see within seconds
if there were changes in the file system of that drive
since last check (250 GB drive with about four million
files on it).

How to accomplish this? (best if providing
directly a Python receipe for it :-)
Do available file systems have something like
archive attribute assigned to the root directory
of the drive?
I suppose not. Am I right?
On Linux there is the FAM (File Alteration Module) for this, as long as I
know. Maybe Python has a wrapper/binding for it.
I ask this question having Microsoft Windows 2000
and Windows proprietary NTFS file system in mind,
but I am also interested to know it about Linux or
Unix file systems.
As long as I know, on Windows there are a few specific "hooks" to perform
such a task. They are provided by the MS API for the NTFS/HPFS file
systems. I do not think Python implements anything so "low level", anyway.
Check the docu to be sure.
I know, that looking for the archive attribute of the
top directories doesn't help when the change
happened to files somewhere deeper in the
hierarchy of directories.


Right. It does not help.

Consider this: if are accessing a network file system, you can intercepts
the calls to the virtualization layer (NFS or NetBIOS). Most likely, Python
can support you in performing this task.

HTH
-----------------------------------
Alessandro Bottoni
Sep 12 '05 #3

"Alessandro Bottoni" <al************ ****@infinito.i t> schrieb im Newsbeitrag
news:O7******** *******@twister 1.libero.it...
Claudio Grondi wrote:
After connecting a drive to the system (via USB
or IDE) I would like to be able to see within seconds
if there were changes in the file system of that drive
since last check (250 GB drive with about four million
files on it).

How to accomplish this? (best if providing
directly a Python receipe for it :-)
Do available file systems have something like
archive attribute assigned to the root directory
of the drive?
I suppose not. Am I right?
On Linux there is the FAM (File Alteration Module) for this, as long as I
know. Maybe Python has a wrapper/binding for it.
I ask this question having Microsoft Windows 2000
and Windows proprietary NTFS file system in mind,
but I am also interested to know it about Linux or
Unix file systems.


As long as I know, on Windows there are a few specific "hooks" to perform
such a task. They are provided by the MS API for the NTFS/HPFS file
systems. I do not think Python implements anything so "low level", anyway.
Check the docu to be sure.
I know, that looking for the archive attribute of the
top directories doesn't help when the change
happened to files somewhere deeper in the
hierarchy of directories.


Right. It does not help.

Consider this: if are accessing a network file system, you can intercepts
the calls to the virtualization layer (NFS or NetBIOS). Most likely,

Python can support you in performing this task.

HTH
-----------------------------------
Alessandro Bottoni


Thank you for your response.

To be more clear I should maybe add, that I have not to do with
drives beeing altered while the system is running. The drives content
can be altered e.g. by the computer of a friend who I gave the drive
out to.
I tell it here, because it seems, that the answer is biased
towards detecting changes done to files on a drive while
running on a system able to monitor the drives activity.

Claudio
Sep 12 '05 #4
> After connecting a drive to the system (via USB
or IDE) I would like to be able to see within seconds
if there were changes in the file system of that drive
since last check (250 GB drive with about four million
files on it).


Whenever a file is modified the last modification time of the directory
containing it is also set. I'm not sure if the root directory itself
has a last modification time field but you can just store and compared
the last mod time of all subdirectories directly under the root
directory.

If you trust the clock of all machines mounting this drives is set
correctly (including time zone) you can store just a single timestamp
and compare for files or directories modified after that time.
Otherwise you will need to store and compare for any changes, not just
going forward.

Oren

Sep 12 '05 #5
On 2005-09-12, Oren Tirosh <or*********@gm ail.com> wrote:
Whenever a file is modified the last modification time of the directory
containing it is also set.


Nope.

$ ls -ld --time-style=full-iso .
drwxr-xr-x 2 grante grante 4096 2005-09-12 12:38:04.749815 352 -0500 ./

$ touch asdf

$ ls -ld --time-style=full-iso .
drwxr-xr-x 2 grante grante 4096 2005-09-12 12:39:35.657995 208 -0500 ./

$ echo "hi" >asdf

$ ls -ld --time-style=full-iso .
drwxr-xr-x 2 grante grante 4096 2005-09-12 12:39:35.657995 208 -0500 ./

$ echo "foo" >asdf

$ ls -ld --time-style=full-iso .
drwxr-xr-x 2 grante grante 4096 2005-09-12 12:39:35.657995 208 -0500 ./

Notice that writing to the file did not change the modification
date of the directory contining it.

--
Grant Edwards grante Yow! - if it GLISTENS,
at gobble it!!
visi.com
Sep 12 '05 #6
hi list,
i'd like to define __repr__ in a class to return the standardrepr
a la "<__main__. A instance at 0x015B3DA0>"
plus additional information.
how would i have to do that?
how to get the standardrepr after i've defined __repr__?

sven.

Sep 12 '05 #7
sven wrote:
hi list,
i'd like to define __repr__ in a class to return the standardrepr
a la "<__main__. A instance at 0x015B3DA0>"
plus additional information.
how would i have to do that?
how to get the standardrepr after i've defined __repr__?

sven.

It's relatively easy for new-style (type-based) classes:
class C(object): ... def __repr__(self):
... return "Extra stuff then\n%s" % super(C, self).__repr__( )
... i = C()
repr(i) 'Extra stuff then\n<__main__ .C object at 0x4e0b6c>'


Not immediately clear how to extend that to old-style objects since they
aren't as cooperative in making their superclass as readily available.

Unless your needs are specifically for old-style classes I'd suggest
using new-style classes.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Sep 12 '05 #8
sven wrote:
i'd like to define __repr__ in a class to return the standardrepr
a la "<__main__. A instance at 0x015B3DA0>"
plus additional information.
how would i have to do that?
how to get the standardrepr after i've defined __repr__?

object.__repr__ (4)

'<int object at 0x94f7d8c>'

Gerrit.

--
Temperature in Luleå, Norrbotten, Sweden:
| Current temperature 05-09-15 19:19:58 7.8 degrees Celsius ( 46.0F) |
--
Det finns inte dåligt väder, bara dåliga kläder.
Sep 15 '05 #9

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

Similar topics

2
11214
by: AMD | last post by:
Hi, I would like to have MySQL use a mapped network drive. I'd like to do this in case there is a failure of the mysql machine, I can just replace it with a new machine pointing to the same network drive. Is this possible at all? Thanks, Andre M. Descombes
5
1716
by: steve Sweales | last post by:
I am trying to design a windows forms application (not asp.net) in C#, and need to know if the following scenario is possible : Once my application is running I need to be able to impersonate another user account which will have access to a network drive that the current user account does not have access to. Is it possible to impersonate the required user account and map to the drive in code, enabling the current user to view the...
1
7602
by: Steve.Goodman | last post by:
Appologies if this has already been asked, but after scanning the web and this news group I could find no decent solution. We have a windows App that calls a webservice, using this bit of basic code. Dim objPreReq As PDCPreReq.PreReqs Dim objProxy As System.Net.WebProxy = System.Net.WebProxy.GetDefaultProxy objProxy.Credentials = System.Net.CredentialCache.DefaultCredentials
6
2718
by: bfowlkes | last post by:
Hello, I am trying to parse two pre-formatted text files and write them to a different files formatted in a different way. The story about this is I was hired along with about 20 other people and it seems we are trying to learn the whole C language in two weeks! To top it all off, I was an English Major, but I'm trying my best. Ok back to the program. So we have two files product_catalog.txt and sales_month.txt The info in...
1
5596
by: Steve Marshall | last post by:
Hi All, Apologies if this has come up before, but how can I set up something that will notify me when a removeable drive (like a USB drive or CompactFlash card) is inserted into its slot? Ideally I would like some sort of event that would call my code when it happens. The FileSystemWatcher object doesn't seem able to do this, unless I am missing something. Thanks
4
11743
by: sajid_yusuf | last post by:
Hi I am trying to develop a Windows service in VB.NET which has timer enabled and keeps checking a folder (or group of folders) for any new file or changed files. As soon as it detects any new file or changes (to files or folders) then it copies the files (and any new folders) to a folder in the mapped network drive. So far I have been successful in developing and deploying the service which works on my local machine with two drives...
5
3431
by: rogersw8n | last post by:
Some how, some way the account that creates folders under Temporary Internet files has been changed to a domain account for VS 2003 and VS 2005. I recently installed VS 2005. All seemed to be ok afterwards. I did no development for a couple of weeks, came back and I kept receiving Access Denied to Microsoft.Net\Temporary Internet Files\... Access is Denied. ASPNET had full access to that file and all subfolders. The website I am...
23
3754
by: Rotsey | last post by:
Hi, I am writing an app that scans hard drives and logs info about every fine on the drive. The first iteration of my code used a class and a generic list to store the data and rhis took 13min on my 60 GB drive. I wanted it to be quicker.
9
13239
by: NvrBst | last post by:
Whats the best way to count the lines? I'm using the following code at the moment: public long GetNumberOfLines(string fileName) { int buffSize = 65536; int streamSize = 65536; long numOfLines = 0; byte bArr = new byte;
0
9690
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
10504
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
10274
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
10251
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
6811
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
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...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.