Page 1 of 1

Automatic detection of file changes outside BRU

PostPosted: Thu Jul 03, 2008 1:56 am
by Link_timeout
It would be nice if BRU could support detection of changes to a directory it's working with by other programs. I sometimes use BRU to move filenames around so new or updated files can be copied in, but unless I remember to manually refresh the display each time I make a change I run into problems where subsequent BRU rename attempts conflict with new files that have been copied in. Change notification support shouldn't be too hard to add:

HANDLE changeHandle = FindFirstChangeNotification( "directory-path", FALSE, FILE_NOTIFY_CHANGE_FILE_NAME );

Then you do a WaitForSingleObject() on changeHandle, and when you get notified
of a change you update the directory listing.

Finally when the user changes to a new directory or BRU exits:

FindCloseChangeNotification( changeHandle );

There's more complete sample code on MSDN at
http://msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx.

Re: Automatic detection of file changes outside BRU

PostPosted: Thu Jul 03, 2008 7:52 am
by Admin
Hi,

Whilst I like the idea, I've always avoided doing this for a number of reasons.

Firstly, BRU has the option to process subfolders, so I could end up with hundreds of folders being monitored.

Secondly, handling a change could be messy. For example, if a new file appeared in a folder then it would have to be added to the BRU list - but where? What if somebody had manually sorted the list? Also, if a file is removed then I'd potentially have to rebuild the entire list (to handle autonumber changes etc).

The idea was considered a couple of years ago, but was then ruled out due to the consequences.



Jim