Skip to content

Instantly share code, notes, and snippets.

@flamendless
Created March 10, 2018 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flamendless/2caf7cb59e4551dd579201d8c7ab69ca to your computer and use it in GitHub Desktop.
Save flamendless/2caf7cb59e4551dd579201d8c7ab69ca to your computer and use it in GitHub Desktop.
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