💾 Archived View for tilde.club › ~oldernow › 2023-12-03-07-39-25.gmi captured on 2023-12-28 at 15:39:10. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

File/directory entropy warrior

It's time, once again, to wade through files/directories created/downloaded during other life battles with sufficient haste to have made painfully disordered waste just crawling with Fear Of Losing Out via deleting a file that *might* come in handy to rectify someone *else's* eff up.

We're talkin' filenames now devoid of meaning, filenames suggesting "attempt iterations" without clarity as to which was actually used in whatever circumstance/situation.

And my least favorite: downloaded files whose names contain white space <slaps forehead hard with eyes closed and mouth grimacing>.

Of course, such leads to writing scripts I've likely written before, except of *course* what made sense as a script name *than* now invokes first class bewilderment.

But that's okay, grep to the rescue. Where oh where did my little find-command-based scripts go? Where or where can they be?

Anyway, it's looking like tilde.club might be permanently gone, so, I dunno, do I go through that effort to find another free gemlog host? What's this <PUTTING IT MILDLY ALERT> *sometimes* compulsive publishing activity really worth, oldernow?

FWIW, here be a "find" command based Lua script that lists files in or beneath the current directory in size (largest to smallest) order:

#! /usr/bin/env lua
local files = {}
local find = io.popen('find ' .. os.getenv('PWD') .. " -type f -printf '%s %p\n'")
for line in find:lines() do
  local size,path = string.match(line, '^(%d+) (.+)


)
  size = tonumber(size)
  table.insert(files, {size,path})
end
find:close()
table.sort(files, function(a,b)
  if b[1] < a[1] then
    return true
  else
    return false
  end
end)
for i,v in ipairs(files) do
  print(v[1] .. ' ' .. v[2])
end

In case you're wondering, I point "find" to $PWD instead of '.' so that filenames in the output are fullpath instead of relative to '.'.