Know which Filesystem a File is on?

If I have 2 files is it possible to know if they are mounted on different filesystems?

I can not see anything described in the Metadata here: Metadata in std::fs - Rust.

Is it possible to work it out from a File's inode?

The reason I ask is because it has been raised as an issue on my project: Add an option to skip directories on other filesystems · Issue #50 · bootandy/dust · GitHub

For Unix machines there's device ID: MetadataExt in std::os::unix::fs - Rust

1 Like

If you're using walkdir (or ignore), then you can use its same_file_system option.

Otherwise, you can copy the implementation which works on Windows: walkdir/util.rs at bab4066b218dc20a625d405e02433d882237d59c · BurntSushi/walkdir · GitHub

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.