#NFTW
Building a Cross-Platform Disk Usage Analyzer in C
I wanted a low-level C project that touches memory management, recursive filesystem traversal, and platform-specific APIs — so I built a terminal disk usage analyzer from scratch. No external libraries, just the C standard library and OS system calls. ## What it does * Recursively scans a directory using `nftw()` * Reports total / used / available disk space (cross-platform) * Lists every file sorted by size (ascending) with a proportional ASCII bar chart === Disk Usage Report === Total: 512.0 GB Used: 210.3 GB Available: 301.7 GB [ ] 2.0 B ./notes.txt [########################################] 50.0 MB ./video.mp4 ## The interesting bugs **Bug 1 — realloc without`sizeof`** total_size = total_size * 2; files = realloc(files, total_size); // ❌ bytes, not entries! Should be `total_size * sizeof(FileEntry)`. Without it, the buffer shrinks to almost nothing and every write past the original bound corrupts the heap — a great reminder that `realloc` takes bytes, always. **Bug 2 — mixing directories into the file list** `nftw()` calls your callback for _every_ entry — files, directories, symlinks. I had to explicitly filter: if (typeflag != FTW_F) return 0; **Bug 3 — no cross-platform disk stats** `statvfs()` works great on Linux/macOS but doesn't exist on Windows. Solved with an `#ifdef _WIN32` split: `GetDiskFreeSpaceExA` on Windows, `statvfs` everywhere else, unified behind one function signature. ## Bar chart scaling Once all files are captured, I scale each bar relative to the largest file found: int filled = (int)((double) size / (double) max * BAR_WIDTH); Then `qsort` with a custom comparator sorts everything ascending by size before printing. ## Repo Single C file + CMakeLists, builds on Linux and Windows (MinGW tested): [https://github.com/SecByShresth/Disk-Usage-CLI.git] Would love feedback on the traversal/performance side — currently it walks the entire tree with no depth limit or exclusion list (`.git`, `node_modules`, etc.), which is next on my list to fix.
dev.to
July 25, 2026 at 10:30 PM
I just discovered nftw(3).

I do not like such a thing being a function with a callback function. I would prefer it being an ‘iterator’ arrangement. I think of this kind of thing—a tree walk—as an example of the PROPER use of ‘iterators’.

Not the way all these languages use them as a substitute […]
Original post on masto.ai
masto.ai
May 2, 2026 at 12:44 PM
Today in 1947 nearly 350K telephone operators, almost all women, walk off the job across 🇺🇸 on strike against AT&T. After the strike the National Federation of Telephone Workers became @cwaunion.bsky.social , converting the NFTW into a three-level union: a national union, 39 divisions, and locals.
April 8, 2026 at 10:33 PM
Today In #LaborHistory 4/7/1947: NFTW #union launched the 1st nationwide #strike against #AT&T & #Bell. 350,000 workers, mostly #women, struck. By mid-May, 37 of 39 member unions had won new contracts & raises. NFTW became the #CWA later that year.
April 7, 2026 at 2:18 PM
Concept Gaming Design by Lumexa 🎮
Custom overlays & thumbnails for streamers & VTubers.
Clean. Professional.
Eye catching.
📩 DM us to start your brand
#gamingusa #fypage #VTuberArt #artbranding #twitchstreamer
#gamesart #nftw #18gaming
January 27, 2026 at 12:08 AM
Sacha Feinberg-Mngomezulu 2025 Skills, Tries & Magic! 😱🇿🇦
The Springboks kid is unreal!

Watch here: youtu.be/NfTW-a8qXHc

#rugby #Springboks #rugbyhighlights #SFM #SachaFeinbergMngomezulu #SachaRugby #rsa #southafrica
SACHA FEINBERG-MNGOMEZULU 2025 ● Skills, Tries & Magic Moments
YouTube video by BRUGBY
youtu.be
December 6, 2025 at 4:13 PM
Rouge 🔥🌶️
L'ensemble du shooting sur mes plateformes OF & Mym

Défi de @tou-te-scoquin-e-s.bsky.social

#photoerotique #transmasc #nftw #biporn #transboy #ass #gayporn
December 1, 2025 at 7:49 PM
GR juice - juice - juice, is back on the mic with Bobby talking about…well… just about everything. mc

podcasts.apple.com/us/podcast/n...
NFTW (66) - GR Joe Makes An Appearance
Podcast Episode · Notes From The Pen · 10/29/2025 · 15m
podcasts.apple.com
October 29, 2025 at 2:05 PM
Spin some laps on with Bobby as he reflects on his 1st few trips around the prison yard 12 yrs ago, plus mc stops screaming, and JD’s in the bedroom? 😳
In 2 weeks Bobby will be on THIS side of the razor wire spouting off at the mouth as a free man, stay tuned. mc podcasts.apple.com/us/podcast/n...
NFTW (65) - Nearly Free, Nite Nostalgia, And Screaming Into The Void
Podcast Episode · Notes From The Pen · 09/24/2025 · 45m
podcasts.apple.com
September 24, 2025 at 3:40 PM
In this weeks NftW, I want folks to look in the mirror and realize that the cutthroat monster you play at work isn’t a character: it's who you are.

With global facism on the rise, now more than ever it is crucial to confront your own inner monster and recognize when it makes you complicit.
Notes from the Wreckage: Edition 10
Happy Monday, my dear reader. This week, I am taking off the kid gloves because it is time to get uncomfortable.
www.linkedin.com
August 11, 2025 at 5:43 PM
Hanging on through massive Spanish pressure FTW! 🙂

Exceptional Keeper Saving Pennos FTW! 🙂

Big Step Penno Belter FTAW! 😃

Sweet Caroline NFTW! 😠
July 27, 2025 at 6:54 PM
@mayor.lacity.gov

FIRST ENCINO
NOW
STUDIO CITY

CRIMINALS DO NOT RESPECT YOU

DO SOMETHING!!!

MAKE A PLAN OF ACTION

youtu.be/NFtw-VYKoYQ?...
Studio City neighbors concerned over increase in home burglaries
YouTube video by KCAL News
youtu.be
July 27, 2025 at 4:08 AM
Come spin a few laps on the prison yard with Bobby and Co-Host JD. There's a bunkie in the cube that holds on to his feelings until they boil over, and hoarding in prison is a real thing for Bobby. mc podcasts.apple.com/us/podcast/n...
NFTW (64) - A Stewing Bunkie, And Prison Hoarding
Podcast Episode · Notes From The Pen · 07/23/2025 · 22m
podcasts.apple.com
July 24, 2025 at 2:36 AM
Here we go again. Black Wall Street. Rosewood. Oscarville. Seneca Village. ...and more. European American farmers are jealous & violently dangerous. To Black Farmers, watch your back, especially if this rumor is true.
-
www.youtube.com/watch?v=NFTw...
Maga Farmers Can't believe Blk Farmers aren't shutting down.... so they Thr8t8ng t0 🔥 blk pp Farms
YouTube video by Queen-Penguin🐧-Uganda
www.youtube.com
July 4, 2025 at 8:24 PM
So I -
Create a new dummy "ram" disk by malloc'ing a bunch of bytes somewhere.
Glue FatFS to this by implementing ioctl, read and write
Run f_mkfs to make the filessystem
Run nftw to recurse a directory and f_mkdir + copy files
Use write function to track written bytes
Save a truncated .bin
June 23, 2025 at 7:03 PM
nftw is pretty good, makes recursively copying a filesystem from native to FatFS an absolute breeze.

Most of my pain was just me being very, very bad at C.
June 23, 2025 at 7:02 PM
🔥Eternal damnation awaits those who haven't read THE MISSIONARY from @ryanstegman.bsky.social & @jasonhowardart.bsky.social. The double-sized, incredibly NSFW finale hits FOC on 6/9 (of course it does) and climaxes on 7/30. Preorder it from your LCS TODAY via PRH!🔥
www.youtube.com/watch?v=nftW...
Ryan Stegman & Jason Howard Want to Damn Your Soul with THE MISSIONARY #3
YouTube video by DSTLRY
www.youtube.com
June 3, 2025 at 9:11 PM
Coming in this weeks Notes from the Wreckage:

🔹️Toxic Positivity Is Emotional Gaslighting
🔹️DEIB Could Have Fixed This Ish
🔹️Crying in Meetings, and Other Power Moves

NftW is my free weekly newsletter on LI where I'm breaking down toxic professionalism and the complicit nature of corporate spaces.
Notes from the Wreckage | LinkedIn
Jillian Jayde Hastings | Unpolished Thoughts from the Edge
www.linkedin.com
June 1, 2025 at 6:01 PM
Bobby shares his parole news, someone is looking for Mark, and getting excited about stand-up. Plus, don't miss a post show clip of mama c and Bobby talking about how his parole news was delivered. mc podcasts.apple.com/us/podcast/n...
NFTW (62) - Parole Decision Is In
Podcast Episode · Notes From The Pen · 05/21/2025 · 38m
podcasts.apple.com
May 21, 2025 at 11:04 PM