Skip to content

Instantly share code, notes, and snippets.

@wookietreiber
Last active November 28, 2016 11:42
Show Gist options
  • Save wookietreiber/2776916a755ffd910ff0ac7bb1c38983 to your computer and use it in GitHub Desktop.
Save wookietreiber/2776916a755ffd910ff0ac7bb1c38983 to your computer and use it in GitHub Desktop.
#!/usr/bin/env r
# create input file with:
# $ find /path/to/dir -type f -printf '%s\n' | gzip > dir.file.sizes.gz
# start with:
# $ zcat dir.file.size.gz | fshist.r
# edit breaks to your needed sizes
# leave the breaks "0" and "2^50" for the edges
suppressMessages(library(stats))
suppressMessages(library(utils))
suppressMessages(library(gdata))
sizes <- scan("stdin", quiet = T)
h <- hist(sizes, plot = F, breaks = c(0, 1, 3584, 2^15, 2^18, 2^20, 2^24, 2^30, 2^37, 2^50))
d <- data.frame (
min = humanReadable(head(h$breaks, -1)),
max = humanReadable(tail(h$breaks, -1)),
count = h$counts
)
print(d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment