Short: Recursive disk-usage analyser, pie chart Author: Markus Lunk Uploader: Markus Lunk Type: disk/misc Version: 1.4 Replaces: disk/misc/DiskUsage-1.1.lha Requires: MorphOS 3.x Architecture: ppc-morphos Distribution: Aminet DiskUsage - where did my disk space go? ======================================= DiskUsage scans a volume or a drawer, adds up the size of every file below it and shows the result largest-first, so the drawers eating the disk the most are the ones at the top of the window. The whole tree is sized ONCE, up front, so walking into a sub-drawer is instant and already sorted - no waiting and re-sorting after every double-click, which was my main annoyance of sizing drawers in an Ambient lister and my motivation for this tool. Three views of the same scan: List the current drawer's contents, biggest first, with size, percentage and date columns. Click a column heading to sort by it, again to reverse. Chart a donut diagram of those same items, one coloured wedge each, with a legend and a tooltip per slice. Biggest files the largest files ANYWHERE below the current drawer, each with the drawer it lives in - so one large file five levels down is a glance away instead of a hunt through "which are my largest directories?" but then they contain masses of small files instead of the large ones you are searching for. Double-click a row (or press Return, or choose Drawer -> Drill into drawer - all three are the same) to jump to the drawer it lives in, with the item selected. It also acts on what it finds: any item can be moved to the Trashcan or deleted outright, and the tree updates without a rescan - the bytes come off every drawer above it and the volume's free space is re-read. If you have your trashcan disabled through ENVARC:NOTRASHCAN, the menu items are disabled. Running it ---------- From Ambient, double-click the icon. From the Shell it also runs WITHOUT opening a window, which is what makes it scriptable: DiskUsage DIR,LIST/S,ALL/S,TOP/K/N,DEPTH/K/N,CSV/S,QUIET/S, OUTPUT/K,SORT/K,DEBUG/S Examples: --------- DiskUsage Work: - open the window on Work: DiskUsage Work: LIST - print the top level and exit DiskUsage Work: TOP 10 - the ten biggest files below it DiskUsage Work: CSV QUIET - one line a script can parse DiskUsage Work: CSV ALL OUTPUT RAM:work.csv - the whole tree as CSV, into RAM:work.csv The report - CSV included - goes to the Shell unless OUTPUT names a file; no file is written anywhere by default. Ctrl-C stops it, with return code 5; a report file that was being written is removed rather than left half-complete. DiskUsage Work: LIST OUTPUT RAM:report.txt - write a report file to the target location There is an ARexx port - DISKUSAGE.1, because MUI numbers the first copy - offering SCAN, VIEW, SORT, GET, GETTOP, RESCAN, STOP, PARENT and QUIT. Three example scripts are in the Rexx drawer, one of which writes a report about several volumes unattended, for S:User-Startup or a Cron entry. Tool types ---------- DIR= the drawer/directory to scan at startup TOOLBARSIZE=<16|24> toolbar height. 24 is the default; anything other than 16 is treated as 24 DEBUG write a log to PROGDIR:DiskUsage.log How the lists are drawn ----------------------- DiskUsage has NO settings of its own for how its lists look. It takes four of Ambient's and obeys them, because the point is to look like the lister already on your screen - and two sets of switches for the same question would only be a way for them to disagree. So if you wonder why a list looks the way it does, the answer is always "because Ambient is set that way", and the place to change it is Ambient. Open its settings -> Lister: Alternated rows every second row 10% brighter Highlighted sorting column the sorted column is tinted Bold directories drawer names bold, so a drawer is not lost among the files Column title (a colour) the colour of the column headings They are read ONCE, at startup, from SYS:Prefs/Ambient/Ambient.prefs, so a change in Ambient takes effect the next time DiskUsage starts. The drawing is MUI's own, so the shades follow your MUI colours too. If nothing happens, all four fall back to Ambient's own defaults - everything off. The usual reason is that Ambient's preferences have never been SAVED on this machine, so the file does not exist yet; opening Ambient's settings and pressing Save creates it. Run DiskUsage once with the DEBUG tool type and PROGDIR:DiskUsage.log says exactly what was read. (The names above are Ambient's own English. On a translated Ambient they appear in your language.) Other languages --------------- DiskUsage follows your Locale preferences, through locale.library and a compiled catalog. 23 translations ship with it: Czech, Danish, Dutch, Finnish, French, German, Greek, Hindi, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Russian, Simplified Chinese, Slovak, Spanish, Swedish, Turkish, Ukrainian and Vietnamese. There is nothing to install - the catalogs sit in Catalogs/ beside the program, where locale.library looks first. With no catalog for your language, or no locale.library at all, the window is in English, which is built in. Only the window is translated; the Shell output, the CSV and the ARexx replies stay English, because scripts read those. The translations were made automatically and HAVE NOT been checked by native speakers besides the German catalog. Their sources ship in Locale/ - the .cd description, one .ct per language and a blank template - so that anyone who speaks one can correct it and send it back, and so a language that is not there yet can be added without touching the program. Means: if you are a native or good enough speaker of language XYZ and find mistakes in the catalogs, please report them back to me so that I can update the catalogs for the next update. And if you want YOUR language to be added, please fill out the template and send it to me as well so that I can include it in the next version. Every catalog is UTF-8, and what a language needs to be READABLE depends on where in the window the text is. The lists, column headings, buttons and the status line are drawn from UTF-8 directly, so all they need is a FONT that has the glyphs. Your keyboard map does not matter to them. The menus, the window title and the About box cannot be: MUI has no way to tell a menu its text is UTF-8, so those are converted into your machine's own character set - which comes from your KEYBOARD MAP, not from Locale. Where that set can spell the language, the menus are translated too (Ukrainian with a Ukrainian keymap, Polish with a Polish one). Where it cannot - Hindi and the CJK languages, for which no 8-bit set exists - they fall back to ENGLISH, which is readable, rather than to question marks, which are not. For a non-Latin language, set the MUI fonts for DiskUsage to one that has the script. DejaVu Sans covers eleven of the twelve non-Latin-1 languages, Hindi needs Noto Sans, and Chinese, Japanese and Korean need a CJK font installed - a stock MorphOS has none at all, and without one you get empty boxes however good the catalog is. I use Noto Sans CJK, Meiryo and Batang for these three languages, other Unicode fonts will also work. Keep in mind that you need to install the fonts before programs can use them. Be aware that loading a comprehensive Unicode font takes much longer than loading non-Unicode TrueType fonts! So be patient when you change the settings for DiskUsage to make use of them. While DiskUsage might run on MorphOS 3.x or even 2.x with limitations to the translations, this remains untested. I recommend you to use MorphOS 3.20 or newer. Below that MUI cannot be told a string is UTF-8, and the whole catalog is converted to your character set instead: complete wherever that set can spell it, English where it cannot. MorphOS 3.20 is a free update to all previous 2.x and 3.x versions, so I encourage everyone to install it if not done yet. Keyboard -------- The menus follow the MorphOS Style Guide: DiskUsage (About, About MUI, Quit), Drawer (Open, Parent drawer, Drill into drawer, Rescan, Abort scan), Selection (Open in lister, Trashcan, Delete, Empty Trashcan), View (List, Chart, Biggest Files, Sort by) and Settings (MUI). The right mouse button over either list opens a context menu of the commands that act on what is under the pointer: Open in lister, Drill into drawer, Move to Trashcan, Delete, Parent drawer, Rescan. Menu shortcuts are held with the RIGHT AMIGA key: O open, R rescan, I open in lister, T move to Trashcan, D delete, E empty Trashcan, 1/2/3 the three views, ? about, Q quit. The toolbar buttons answer to P (parent), R (rescan), A (abort the scan) and D on their own - P and S have no right-Amiga key, as the Style Guide keeps those for Print and Save. With rows picked in either list, Del moves them to the Trashcan and Shift+Del deletes them for good. Both ask first, and the requester's default is always Cancel - Return and Escape both cancel it, so the key you press by reflex can never be the one that erases a file. A shortcut is the CHARACTER, not the key it happens to sit on, so on a keymap where that character needs Shift you hold Shift as well. On a German keyboard "?" is above "ß", which makes About right-Amiga + Shift + ß. That is how MorphOS matches menu shortcuts generally. What is new in 1.4 ------------------ * A path button in amber warns you that it takes additional time to calculate the file sizes of that parent level. The buttons appear amber when you drag and drop a path of at least first directory level onto DiskUsage. The row shows the drawers ABOVE the one you asked DiskUsage to analyse as well, in amber. Those were not scanned yet, so going there is not a move inside the tree already in memory - it is a NEW SCAN, of a drawer holding everything you can see now plus all of its neighbours. On a large volume that can take minutes rather than an instant. This is why the buttons are in warn colour so that you can see before which levels are not scanned yet and decide to abort before starting the action. The buttons say so in their bubble help, and a whole volume always asks before it starts - with Cancel as the DEFAULT, so pressing Return cannot set a long scan going by accident. A scan can be aborted while it runs, and the path row scrolls with the little arrows at its ends when it grows wider than the window. You know this feature from Ambient listers already. * The path is a row of buttons, like an Ambient lister's: one per drawer between the scanned drawer and the one on display. Click any of them to go there; the drawer you are in is shown bold and is not a button. The row starts at the drawer you asked DiskUsage to analyse - the drawers above it were never read, so there is nothing there to go to. What is new in 1.3 ------------------ * The lists follow Ambient's lister settings while they are being changed, not only when DiskUsage starts. Turn "Verzeichnisse fett", "Alternierende Zeilenfarbe" or "Hervorheben der Sortierspalte" on or off and the lists change with it, within about a second, with no need to save the preferences or restart anything. Ambient keeps a live change in its own memory rather than on disk, so DiskUsage asks Ambient for the current setting instead of reading the file - the file is still read too, for the settings you have saved. * The window uses Unicode text only where it is needed. When every translation moved to UTF-8, every part of the window moved onto the Unicode drawing route with it - including on a German or English machine, which never needed it. It now does so only where the machine's own character set cannot spell the language - Greek, Cyrillic, Chinese, Japanese, Korean and the rest - and draws the way it did before everywhere else. Nothing is lost in those languages: they are still drawn in full. This has NOT yet restored the bold drawer names reported missing on build 123, which is what it was changed for. This build adds a DEBUG line recording the exact bytes handed to MUI for the first drawers. * Fixed: Delete was enabled again at the end of every scan, even with nothing selected, and pressing it did nothing. Finishing a scan re-enabled the button directly, and the code that greys it saw its own last note still matching and left the button alone. * Fixed: the scan line named the wrong key. It now reads "- A to abort"; it still said S after the button became Abort, in English and in all 23 translations. * Fixed: the path is now drawn like the rest of the window and sits on the "Path:" button's line. The path banner was the one piece of text still handed to MUI without saying it was UTF-8, so it went through the character-set conversion while everything beside it went through the font engine - two routes, two sets of metrics, and the two halves of one line never quite lined up: a pixel in most languages, eleven in Chinese and Korean. A path with accented or non-Latin characters is drawn properly now too. * Fixed: the chart's background turned black after changing the MUI font. The donut samples the colour behind it once, so it does not flicker while you move the mouse over the slices; changing the font relays the window out, and the remembered colour then came from the wrong place. It now takes the colour again when the chart moves or is resized. * DiskUsage speaks 23 languages through locale.library: Czech, Danish, Dutch, Finnish, French, German, Greek, Hindi, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Russian, Simplified Chinese, Slovak, Spanish, Swedish, Turkish, Ukrainian and Vietnamese. Nothing to install, and English wherever there is no translation. The translations were made automatically and want correcting by people who speak the languages - their sources ship in Locale/ for exactly that. See "Other languages" above. * A Date column, on both lists, in your Locale's own date format. A drawer shows its own date, not the newest thing inside it, and a date the filesystem cannot supply leaves the cell empty rather than showing one nobody meant. * The lists sort by any column. Click a heading, click it again to reverse, or use View -> Sort by. Size and Date start with the biggest and the newest; Name starts at A. The two pages keep their own order, and an item with no date sorts last whichever way round the list is - a missing answer is not an old one. The chart is not affected; it stays largest-first, which is what makes a donut readable. * The lists follow AMBIENT'S OWN list settings - alternating row colours, the highlighted sort column, bold drawer names and the column-title colour. DiskUsage has no settings of its own for any of it. See "How the lists are drawn" above. * A context menu on both lists, on the right mouse button: Open in lister, Drill into drawer, Move to Trashcan, Delete, Parent drawer, Rescan. Everything in it is also in the menu bar and asks the same questions before removing anything. * The "Path:" label in the window is now a button. Click it and the drawer requester opens, so changing what is scanned is where the path already is, instead of only in Drawer -> Open... The menu item and its right Amiga + O are unchanged. What is new in 1.2 ------------------ * The menus follow the MorphOS Style Guide. The one long Project menu is now five: DiskUsage, Drawer, Selection, View (ticked on the view showing) and Settings. * Settings -> MUI... opens DiskUsage's own MUI settings. * Drawer -> Drill into drawer: with one row picked in Biggest Files, go to the drawer it lives in - the same as double-clicking the row, which has always worked and was never mentioned here. Disabled for several rows, which have no single drawer to go to. * Ctrl-C now stops DiskUsage in the Shell. It used to be ignored for the whole scan - minutes, on a big network volume. * Right Amiga + P and + S no longer mean Parent and Stop: the Style Guide keeps them for Print and Save. The toolbar keys P and S still do both. What is new in 1.1 ------------------ * Version bump for official release, no functional changes What is new in 0.58 ------------------- * Volumes over 2 TB now show their real size. 0.57 stopped DiskUsage believing a filesystem's placeholder, but it could then only fall silent - a 3.5 TB share got no size at all. MorphOS has a proper answer: GetFileSysAttr() with FQA_NumBlocks / FQA_NumBlocksUsed, which return 64-bit block counts and which any filesystem able to grow past 2 TB is required to implement. That is asked first now, with the old Info() figures as the fallback for everything else. What is new in 0.57 ------------------- * Fixed: a big volume could be shown at the wrong size, and as full when it was not. A 3.5 TB network share showed as "100% full (2.0 TB of 2.0 TB)". AmigaDOS counts a volume in blocks in signed 32-bit fields, which cannot hold one that large, so the filesystem had written a placeholder into both the size and the used count and DiskUsage believed it. Those placeholders are now recognised, and where the figures cannot be trusted the title shows the volume name alone rather than a confident wrong number. What is new in 0.56 ------------------- * Opening a drawer draws its chart about 2.5x quicker. 0.55 made hovering cheap; this does the same for the one computation it left. Working out which slice a point falls in is now a table lookup instead of a walk along every slice boundary, and the corners and the hole - nearly half the area the donut sits in - are filled without asking about them at all. 15.5 ms to 6.1 ms on the development machine. The picture is unchanged, and tested to be. What is new in 0.55 ------------------- * The chart redraws far more quickly, and looks exactly the same. Moving the pointer over the slices changes one colour, but the program was re-deriving the whole donut to do it - working out for every one of 731,000 subsamples which slice it belongs to. That is now worked out once and kept; a redraw just colours it in. On the development machine the redraw went from 17.6 ms to 0.131 ms, and the image is verified identical to the old one pixel for pixel. This helps every machine and the slowest ones most: an EFIKA 5200B or a Pegasos I has no AltiVec to fall back on, so the only thing that helps them is doing less work. What is new in 0.54 ------------------- * OUTPUT= wrote the report nowhere. The file name was still being pointed at inside dos.library's argument buffer after that buffer had been handed back, so the file was opened under whatever happened to be there by then. Fixed. * The toolbar comes in two sizes - TOOLBARSIZE=16 gives a smaller row with every gadget the same height. * The view chooser is the same height as the toolbar buttons again. * The chart no longer sits on a patch of its own colour, and does not flicker when a slice lights up under the pointer. * GET VIEW now answers what VIEW MODE accepts - LIST, CHART or TOP - so a script can read the current view and put it back afterwards. It used to reply with the label shown in the window, including "Biggest Files", which VIEW MODE cannot take. * The ARexx port is no longer called DISKUSAGE but enumerated, starting with DISKUSAGE.1, in order to allow multiple instances in parallel which makes sense especially when scripting DiskUsage. Requirements ------------ MorphOS 3.x on PowerPC, nothing else. At the 24-pixel toolbar size the Parent and Delete glyphs are Ambient's own, read from its drawer at run time, so the row matches every other toolbar on the system; at 16 pixels the program supplies its own. Status ------ Version 1.1 was the first public release. At the moment, I consider it feature-complete for my needs in the shape of a standalone program. It is a complete, self-contained program - the scanning core, the three views, and removing what they find all work and are tested - but it is still being polished. Reusing it as an auto-reordering Ambient lister is a later goal. The archive's Readme has the full documentation. Development assisted by GenAI. Freely distributable. (C) 2026 Markus Lunk.