Skip to content
This repository was archived by the owner on Jun 8, 2022. It is now read-only.
This repository was archived by the owner on Jun 8, 2022. It is now read-only.

Proper way to detect real rename #104

@aktau

Description

@aktau

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 a delete/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 with os.SameFile, going over all saved os.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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions