Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Love2D api/wiki trimmer (removes non-english .html files). Also useful for other batch deletion using lua and lfs.
--LOVE2D api/wiki trimmer
--Also useful for other batch deletion using lua and lfs
--Created by Brandon Blanker Lim-it @flamendless
local lfs = require("lfs")
local toRemove = {
"_deutsch",
"_portugu",
"_fran",
"_polski",
"_espa",
"_esky",
"_ti_ng_vi_"
}
local dir = arg[1]
assert(dir, "arg1 is the directory where the files are stored.")
for file in lfs.dir(dir) do
for _, tr in pairs(toRemove) do
if string.find(file, tr) then
print(file .. " is removed: " .. tostring(os.remove(dir .. "/" .. file)))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment