O
O
oxemelot2018-11-06 16:14:18
linux
oxemelot, 2018-11-06 16:14:18

How to find sparse files in Linux?

Who knows how to find sparse files in a directory via the command line or MC?
What is a sparse file can be found on Wikipedia here .
Why do I need this... there is a torrent downloader on Debian + rtorrent + rutorrent, I download distributions where there are many, many files in one directory (a thousand - several thousand). The torrent is designed in such a way that it downloads the distribution in blocks (for example, 32 mb each), i.e. to download one file from the distribution, it can capture the beginning or end of the files adjacent to it. The logical size of such "neighbors" will be equal to the size of the file, and the actual size on the disk will not exceed the size of one or two torrent blocks.
You can view such files through ls -ls (not to be confused with ls -la). Also, the actual size of such files and directories is correctly displayed by du -hs *. In MC, the logical size is displayed (and sorting also works on it, which does not suit me).
So... I need to somehow filter it all out so that only those files whose logical size matches the actual size are displayed, i.e. fully downloaded files. How to do it?
Look with your eyes in rutorrent and what is uploaded there is 100% not to offer. I want to watch it through the console, followed by writing the list to a file through ">". If it is possible to export such a list from rutorrent, then tell me how, otherwise Ctrl + C does not work there when the desired list of files is selected.
I dug in the direction of find, but it does not seem to have such keys that will help to do this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2018-11-06
@Rsa97

find / -type f -printf "%S\t%p\n" | gawk '$1 < 1.0 {print}'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question