Usually I like to use a following diff command setup to recursively compare 2 directory structures:
diff --brief --recursive dir/one dir/two
However on my last attempt it returned nothing, so I thought, hey that's good, but then I've opened properties of each of those folders:
- same number of files 6496 items
- the sizes were almost the same, but just almost 1 has 660,5MB but the other one has 660,7MB - 200KB difference
And since this is in a process for data import purposes I need to know:
- How can this happen?
- Does
diffalso compare contents? Or is it optional? (if so, how can one enforce that?) Could not find more info in docs.
Additional important info:
Both folders have the same data source but different tool was used to extract them
Both folders have the same parent directory
OS is Ubuntu 20.04.2 LTS
Filesystem where they're stored is Ext4(Version 1.0) on an SSD disk
GUI tool for folder properties was used Nautilus - Gnome's "Files" version 3.36.3-stable
EDIT: During solving this Q I've created a little Python3 script, that just blindly counts all files(not folders) and their total size count in bytes for all directories you will send to it
1. save this code: https://ideone.com/4pu1qs as quick_dir_compare.py
2. use as python3 quick_dir_compare.py dirpath1 dirpath2 .....
2.x if you don't have python3: sudo apt install python3 before 2.
license: I grant free for all legal and human-rights purposes
--apparent-sizeas I suggested in my first comment?cd dir/one; find . -type d -ls | sort > /tmp/listing-one.txt, and the same for the other one, and diff those listings. If you see any differences, it's what @ctrl said, that the sizes of the directories are not the same. That's normal, the space allocated for the directory is extended when more space is needed (more files created), but never reduced or compacted. Similarly, you could run the same with-type finstead, to look at the sizes of the files. (Note, you want tocdin the dir, and givefindthe path., otherwise the paths are different for all files.)