Why file size is different when select them from the size when copying?

Solution 1:

Because when you select the folder for copying, Thunar only reports the size of the folder itself and not the contents contained.

Selecting 2 folders and 1 file shows only 176 bytes as that is the size of the script file:

enter image description here

enter image description here

Right clicking on one of them and selecting Properties shows full size of all:

enter image description here

Hope this helps!

Solution 2:

Some of them may be sparse files; at least before they are copied. Some file managers don't copy sparse files correctly, i.e. they fill the "gaps" in the file with real zeroes, actually consuming that disk space. Thunar is one of them.

Unfortunately, it's not that trivial with standard tools to find out what files are in reality sparse files.

[sh @ balrog] .../work/test/sparse 11 % ls -l
total 1028
-rw-rw-r-- 1 sh sh 1049624576 Feb  5  2016 sparse-1MB.bin
-rw-rw-r-- 1 sh sh       8192 Jun 16  2020 sparse-8k
-rw-rw-r-- 1 sh sh       8192 Jun 16  2020 sparse-8k-zero
-rw-rw-r-- 1 sh sh 1048576000 Feb  5  2016 sparse-zero.bin

[sh @ balrog] .../work/test/sparse 12 % ls -lh
total 1,1M
-rw-rw-r-- 1 sh sh 1001M Feb  5  2016 sparse-1MB.bin
-rw-rw-r-- 1 sh sh  8,0K Jun 16  2020 sparse-8k
-rw-rw-r-- 1 sh sh  8,0K Jun 16  2020 sparse-8k-zero
-rw-rw-r-- 1 sh sh 1000M Feb  5  2016 sparse-zero.bin

[sh @ balrog] .../work/test/sparse 13 % ls -lhs
total 1,1M
1,0M -rw-rw-r-- 1 sh sh 1001M Feb  5  2016 sparse-1MB.bin
4,0K -rw-rw-r-- 1 sh sh  8,0K Jun 16  2020 sparse-8k
   0 -rw-rw-r-- 1 sh sh  8,0K Jun 16  2020 sparse-8k-zero
   0 -rw-rw-r-- 1 sh sh 1000M Feb  5  2016 sparse-zero.bin

QDirStat can tell you:

QDirStat showing sparse files

Thunar cannot:

Thunar showing sparse files

It shows you the wrong combined size; well, at least the wrong sizes before it mangles those files when it copies them, because then you will really need the full size, even though that's not at all necessary, and you won't have a true 1:1 copy of those files when Thunar is done messing with them.