From ee3526696d0d697309c5f46dcacb125102ebfa81 Mon Sep 17 00:00:00 2001 From: h1n1 Date: Sun, 26 Jul 2026 10:53:03 +0000 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B0=D0=BC?= =?UTF-8?q?=D0=BC=D1=8B:=20`find`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Программа откопанная где то внутри моего эмулятора CraftOS-PC. В теории должна быть рабочая везде. --- bin/find.lua | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 bin/find.lua diff --git a/bin/find.lua b/bin/find.lua new file mode 100644 index 0000000..bac25eb --- /dev/null +++ b/bin/find.lua @@ -0,0 +1,36 @@ +-- File finder. +-- by H1N1, 2026 + +-- TODO: make help page! + +local function listdir(path, findpattern) + + local list = fs.list(path) + + for k, v in pairs(list) do + filename = path .. "/" .. v + if fs.isDir(filename) then + listdir(filename, findpattern) + else + + if findpattern then + local s, e = filename:find(findpattern) + if s then + local ls = filename:sub(1, s-1) + local h = filename:sub(s, e) + local le = filename:sub(e+1) + local defcolor = term.getTextColor() + write(ls) + term.setTextColor(colors.red) + write(h) + term.setTextColor(defcolor) + print(le) + end + end + end + end +end + + +local args = {...} +listdir("", args[1])