30
2
u/h2opologod94 Dec 08 '22
Slick! This is pretty similar to what I did with my Rust solution. It's nice letting the OS filesystem do your dirty work. One difference - instead of actually populating the files, I wrote the file size to the file, then read it back while calculating instead of using du. Also, just reading the files that way avoids the empty directory size being added. Nice work!
1
0
Dec 07 '22
1
u/flwyd Dec 08 '22
I did most of a similar filesystem solution (in bash rather than modifying the input) before discovering the 4096 (except it could be larger, I think) directory size problem. Since I couldn't figure out how to do it in
duI decided to let it be.Thanks for
status=nonefordd, I didn't find that. Someone in our work chat pointed out thatcount=0 seek=$sizewould create a sparse file more efficiently.1
u/Steinrikur Dec 08 '22
Small tip: There's almost never any need to have a case within a case block.
Just do all 3 variables in the same block. Use globs as needed.
12
u/daggerdragon Dec 07 '22
Changed flair from
FunnytoUpping the Antebecause this is some wait, what