I want to determine if I have already seen the file and would like to identify it with something unique. Under Linux, there is an inode number along with a device identifier (see stat()or fstat()). I assume that under Windows I would find something similar.
To get started easily, boost::filesystemoffers convenient methods, for example. I can use boost::filesystem::recursive_directory_iteratorto navigate the directory tree. file_statusgives me if this is a regular file but not an inode number.
The closest I found is boost::filesystem::equivalent()with two paths. I guess this is also the most portable design.
The thing is, I would like to put the inode numbers in the database for a quick search. I can not do this with this function, I would have to call equivalent()with all the paths that already exist in the database.
Am I really out of luck and the promotion will not provide me such information due to portability concerns?
(edit) The goal is to detect duplicates using hard links during a single scan of the folder tree. equivalent()does just that, but I would have to do a quadratic algorithm.
Borph source
share