Please disregard this public post if
- you think that you have not had any disk space problems in recent years and that the author quite frankly might just be behind on personal computing technology since everything is done "off the cloud" these days, or --
- you think the problem is too advanced for you to even try anything (like simply analysing your file system hierarchically, on your own) and you trust that "common" (commercial) solutions are your best options -- whenever it happens
As for us, mere mortals, the problem pops up now and then, especially when you're working with media or other "big data" on your personal machine.
Yes, the goal is always to automate disk space management -- and you absolutely should rely on secure software (not your home-brewed scripts) for your routine maintenance -- and when you inevitably need more space, that software should politely notify you of new resource requirements -- in advance.
But, as you quickly discover, this goal may sometimes be reached, and then, it may get away again. In other words, before another data flow involving your personal machine is automated, or in order to deal with some non-standard (yet apparently plausible) disk space situation -- sometimes, you just have to get your hands dirty...
...well, as dirty as a geek's hands can get, so, not very dirty, and to keep them cleaner yet, you write scripts -- "micro" in size and functionality "by definition" (by following good practice; See my note on programming vs scripting).
This is an example of a (n under-100-lines or under-two-pages-of-code) hierarchical-file-system-analysis-helper script: ...
It uses an already excellent du and prints the heaviest file-system objects
hierarchically, and that's it: ...
Well that script's not been much, but it might be useful to you nevertheless. And if you -- my trusted professional peer* -- happen to write such a script, I would like -- very much -- to see it, and possibly, to copy it.
* one of the dozens fellow software engineers I worked at some time with, and whose day-to-day professional problems and their solutions to them tend to be similar to mine
Now, let's think of the ways you would go about sharing or publishing such a script:
- yes, you may write an elaborate blog post like this, but realistically, no one (of your followers) will think to organise a bookmark or anything -- either they'll have a (quite rare) disk space problem right then, or the info will be lost to the search engines and social networks which are too, very real-time-feed-oriented and will probably not help me find -- or collaborate on that script efficiently -- when I need it;
- or, in addition to writing a post, you may share the code within one of the open-source social networks, but, to me, it is marginally more efficient in terms of realistic accessibility than in the first case, plus, when open-sourcing that script you will have to pass the (quite sensible) barrier of entering that public space, with its protocols, community standards, etc, which might be inappropriate for such a small piece of code;
- and, what I'd really like is for all such generic (as in non-project-specific) code of my peers -- whether it's of a library, a package, or a script they've been working on -- with a help of a simple sharing mechanism -- to be just available on my development machine (NB code doesn't take much disk space), so when needed, I'll just try and locate that script of yours in my local code base, and then, collaborate on it in the same ad-hoc fashion.
Do you agree with my definition of the casual code sharing problem?
How do you solve it with your peers?
Would you like to see my pragmatic solution to the problem?
Please share and comment if you've made it this far already.
Typical output on MacOS: https://gist.github.com/costa/efe4a93982411ffc730d92ace451f1f7