Automatic detection of file changes outside BRU

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Automatic detection of file changes outside BRU

Postby Link_timeout » Thu Jul 03, 2008 1:56 am

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.
Link_timeout
 
Posts: 2
Joined: Sat Jan 28, 2006 11:30 am

Re: Automatic detection of file changes outside BRU

Postby Admin » Thu Jul 03, 2008 7:52 am

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
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm


Return to BRU Support