hrrmsn / ffcleaner

cmd tool to cleanup littered directories (Files&Folders cleaner)
0 stars 0 forks source link

What's wrong with memory units in Linux and in Windows? #42

Closed hrrmsn closed 7 years ago

hrrmsn commented 7 years ago

I surprised that Linux thinks 1kB consist of 1000 bytes rather than 1024 bytes.

linux_screenshot

Unlike Windows XP which thinks 1kB consist of 1024 bytes.

windows_screenshot

hrrmsn commented 7 years ago

I cleared up this issue by reading following articles.

https://blogs.gnome.org/cneumair/2008/09/30/1-kb-1024-bytes-no-1-kb-1000-bytes/

https://www.quora.com/Where-do-we-use-1-kB-1000-bytes-1-MB-1000-kB-1-GB-1000-MB-1-TB-1000-GB-And-where-do-we-use-1-KB-1024-bytes-1-MB-1024-KB-1-GB-1024-MB-1-TB-1024-GB Citation: "Software is also phasing out the base-1024 usage of SI prefixes. Mac OS X ≥ 10.6 and Ubuntu ≥ 10.10 now use the SI prefixes exclusively to refer to powers of 1000." (See Ubuntu's Units Policy.)

https://en.wikipedia.org/wiki/Kilobyte Citations: "The unit symbol is kB." "The binary interpretation of metric prefixes is still prominently used by the Microsoft Windows operating system..."

hrrmsn commented 7 years ago

So finally I decided to use such algorithm. I should check the operating system name. In case of Linux or Mac OS the script will be think that 1 kB = 1000 bytes. In case of Windows the script will be consider that 1 kB is 1024 bytes.

hrrmsn commented 7 years ago

DONE.