2

I have a folder called 'objects' in my mac.

When I check the contents of it in the terminal it's showing like this. Image from terminal

Clearly object folder shows 4.1K

However when I see it in the finder,

Image from the finder

It shows, 26.3 MB

What's the reason for the significant increase in the size in the finder?

  • 1
    What did you alias ls to? The output you show is not standard for a simple ls. – nohillside Dec 29 '18 at 12:16
  • @nohillside I have aliased ls to 'ls -lh' – Prajwal Dec 29 '18 at 13:14
  • The image shows a file size of 25.7 MB but in the text you write 26.3 MB. Where did the last figure come from? – 11684 Dec 29 '18 at 21:33
5

You have to enter the command du -sh * instead of ls to get the actual size of the folders in your current directory (the sum of the files size they contain).

The command ls shows file size, but it has a different meaning for folders. It actually shows the size allocated for the directory to store metadata (mainly the index) of the files it contains.

  • Oh. When I try to transfer the folder to drive, it's actually transferring the entire 26 MB. Is there anyway I can transfer only the actual file size i.e. 4KB? – Prajwal Dec 29 '18 at 11:45
  • 2
    @Prajwal 26 MB is the actual size of your folder with all its content. The only way to reduce its size is to compress it. – Yoric Dec 29 '18 at 11:51
  • 1
    @Prajwal you can remove the contents of the folder and only transfer that. Then Finder and ls wound agree on the size. – Tim Dec 29 '18 at 13:32
  • @Tim And nuke the git metadata at the same time? – D. Ben Knoble Dec 29 '18 at 14:17

You must log in to answer this question.

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