Nautilus doesn't count hidden files.
Files and directories starting with a dot (
.) are hidden in Linux.
Steps to reproduce:
mkdir somedir && cd somedir
touch .hidden .hidden2 regular regular2 # 4 files, 2 hidden
find . | wc -l # outputs 5 (4 files + dir itself)
Nautilus reports: Contents: 2 items, totalling 0 bytes
Here's a quick demonstration on the amount of files for the metadata used in Git, all in the
git init myrepo # Initialized [...] in myrepo/.git/
find . | wc -l # outputs 23! for an empty repository
tree -a # outputs 10 directories, 12 files
echo "have to add something for git ls-tree" > somefile
git add somefile && git commit -m "Initial commit"
find . | wc -l # outputs 38 (!)
git ls-tree -r HEAD | wc -l # outputs 1
And also Nautilus reports 1 there.
My suggestion: use
As Gilles pointed out in his answer, using
find and piping it to
wc isn't overly reliable if the file names contain special characters.
It seems that
tree is capable of doing this right:
│ └── regular3
2 directories, 5 files