TangentFox icon

(maintained cross-platform elsewhere) move-non-images.lua (Windows-specific)

TangentFox | PRO | 06/18/25 10:46:34 AM UTC (Edited) | 0 ⭐ | 1947 👁️ | Never ⏰ | []
Lua |

570 B

|

None

|

0 👍

/

0 👎

-- https://github.com/TangentFoxy/lua-scripts  move-non-media.lua  is better and cross-platform :D
 
local image_types = { ".mp4", ".png", ".jpg", "jpeg", ".gif", "webm" }
 
os.execute("dir /w /b > files.txt") -- Windows-specific
os.execute("mkdir non-image")
 
local file = io.open("files.txt")
 
for line in file:lines() do
  local keep = false
  for _, t in ipairs(image_types) do
    if line:sub(-4) == t then
      keep = true
      break
    end
  end
  if not keep then
    os.execute("move \""..line.."\" non-image/")
  end
end
 
os.remove("files.txt")
 

Comments