1

I need to tar-gzip files below a certain size in a directory. I tried the command suggested from this post and it works, but when I changed the argument for find -size to -1G, it ignores some files even when the file size is below 1GB. When I supplied -100M and even -900M those files were not ignored.

Some information about the files:

The files in the directory consists of several medium-sized files (1-200 MB) and thousands of tiny files (<1 MB each).

The medium-sized files are executables (.exe extension).

The tiny files are just some random files with either no extension or .lat extension.

When I supplied -900M, all the tiny and medium-sized files are returned as the result. However, when I supplied -1G, all the medium-sized files and many tiny files are missing from the result.

Question:

Is there anything I miss here about the usage of -size -1G?

Other (possibly useful) info:

I'm running Ubuntu 15.04 as a VM on my Windows 8.1.

If anyone suspects it has something to do with the files I'm working with, please let me know and I will upload the all the files in question.

I'm rather new to Unix/Linux and this is my first question in superuser forum so if I have unintentionally violated any rules please kindly let me know.

2

1 Answer 1

0

Answer can be found on https://unix.stackexchange.com/questions/50763/find-size-1gb-in-centos.

In summary, the - in -1G is like a < sign, so <1G is actually 0G, which is why it does not return files less than 1024M as expected.

I'm still not sure why in my case, it returns some of the tiny files as the result, so if anyone would like to give an explanation for it are welcome to do so.

I'm keeping this question (and answer) because this issue is not unique to CentOS and people searching for the problem without the "CentOS" keyword may not be able to find the post referred above.

Not the answer you're looking for? Browse other questions tagged .