Is it possible to artificially trigger ReadDirectoryChangesW?

-1

I'm creating an application for changing file metadata. I'd prefer that metadata edits not affect a file's modified date, so I'd like to suppress modification-date changes by doing this:

FILETIME ft = { 0xFFFFFFFF, 0xFFFFFFFF };
SetFileTime(hFile, NULL, NULL, &ft);

The only downside is that this apparently results in ReadDirectoryChangesW not being triggered, so changes don't sync over something like Dropbox. I was wondering if there's a way to suppress the modification-date changes but also to artificially trigger ReadDirectoryChangesW so that modifications register. In other words, to have the best of both worlds. Is that possible? Thank you very much for any info.

c++
windows
shell
winapi
metadata
asked on Stack Overflow Mar 17, 2020 by (unknown user) • edited Mar 17, 2020 by (unknown user)

1 Answer

1

No, you cannot artificially trigger ReadDirectoryChangesW(), especially if you are not the listener. ReadDirectoryChangesW() is monitoring the filesystem itself, so only real filesystem events will trigger it.

answered on Stack Overflow Mar 17, 2020 by Remy Lebeau

User contributions licensed under CC BY-SA 3.0