Tim Golden wrote: > Claudio Grondi wrote: > >> I am aware, that it is maybe the wrong group to ask this question, but >> as I would like to know the history of past file operations from >> within a Python script I see a chance, that someone in this group was >> into it already and is so kind to share here his experience. >> >> I can't believe, that using NTFS file system in Microsoft Windows 2000 >> or XP it is not possible to track file events as: >> >> - updating/modifying of an existing file/directory >> - deleting an existing file/directory >> - creating a new file/directory >> - _moving_ an existing file/directory (should _NOT_ be covered by the >> event duo of deleting an existing and creating a new file/directory) >> >> Any hints towards enlightenment? >> >> Claudio Grondi > > > On the offchance that you haven't seen it, you might > look at this: > > http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html#use_readdirectorychanges > > > > but since it doesn't fulfil your criterion of *not* > representing renames by a delete and an add, it may > well not be suitable. Apart from that, I think it does > what you want. > > TJG Here a small update to the code at http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html#use_readdirectorychanges :
ACTIONS = { 1 : "Created", 2 : "Deleted", 3 : "Updated", 4 : "Renamed from something" 5 : "Renamed to something", } The correction above is according to entries: #define FILE_ACTION_ADDED 0x00000001 #define FILE_ACTION_REMOVED 0x00000002 #define FILE_ACTION_MODIFIED 0x00000003 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 in ..\PlatformSDK\Include\WinNT.h Claudio Grondi -- http://mail.python.org/mailman/listinfo/python-list