-
Notifications
You must be signed in to change notification settings - Fork 252
Proper way to detect real rename #104
Comments
It would be amazing if this could be done in a cross-platform fashion. I know it's not easy though. I've been watching your work (and of course of all other contributors) and I'd just like to say thanks! So I take it that my way is currently the only viable way to reliably detect renames in a folder structure with fsevents?
In fact, I'm using the |
Yes, they are fairly similar. I've taken the liberty of removing some (buggy) features, but little has been added. The API isn't final, but it is based on discussions with Go core team members (rsc, minux). If you would like to open an issue to improve the Rename Op, I would be grateful: |
Done, thanks: fsnotify/fsnotify#26 |
Note: I don't necessarily need this in a cross-platform way, Linux-only would be fine. But cross-platform is always nice.
I'm making a recursive watcher for a medium-sized folder structure (~50000 files organized in a tree). I'd like to properly detect renames within the structure, so I can
update
some fields in a database instead of adelete/insert
combo.As of now, the only decent "solution" I've come up with is to walk the entire folder structure and save all
os.FileInfo
structs in a slice. Then, when a CREATE event comes (because the RENAME event doesn't mention the new name, it seems a bit useless). I check whether I already knew the file withos.SameFile
, going over all savedos.FileInfo
's. This sounds very heavyweight and I'd like to avoid it if at all possible.Am I going about this the wrong way? Did I not look hard enough on Google and the mailing list (go-nuts)? (if that's the case, I apologize, I did try searching).
The text was updated successfully, but these errors were encountered: