File size distribution: Difference between revisions

J
m (→‎{{header|Phix}}: added syntax colouring, marked p2js incompatible)
(J)
Line 993:
24.00MB <-> 26.66MB = 1 0.145%: ▍
</pre>
 
=={{header|J}}==
 
We can get file sizes of all files under a specific path by inspecting the last column from dirtree. For example, the sizes of the files under the user's home directory would be <tt>;{:|:dirtree '~'</tt>
 
From there, we can bucket them by factors of ten, then display the limiting size of each bucket along with the number of files contained (we'll sort them, for legibility):
 
<lang J> ((10x^~.),.#/.~) <.10 ^.1>. /:~>{:|:dirtree '~'
1 2
10 8
100 37
1000 49
10000 20
100000 9
1000000 4
10000000 4</lang>
 
=={{header|Julia}}==
6,951

edits