On 27Mar2019 21:49, Paulo da Silva <p_s_d_a_s_i_l_v_a...@netcabo.pt> wrote:
I don't know if this is the right group to ask ... sorry if it isn't.
Is there a way to get the file extensions of a file in linux, the same
way as "filefrag -e <filename>" does?
The purpose is to see if two files are the same file, namely those
copied with the --reflink option in btrfs.
A solution for C is also welcome - I can write a small python extension
to handle that.
BTW, executing filefrag from python is not a solution, because I have
lots of files and that would be too slow.
The filefrag manual entry says it works by calling one of 2 ioctls. You
can do that from Python with the ioctl() function in the standard fcntl
module. I haven't tried to do this, but the results should be basicly as
fast as filefrag itself.
You'll need to decode the result the ioctl returns of course.
Cheers,
Cameron Simpson <c...@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list