local FileSystem = require("filesystem")
local fs = FileSystem.new()
-- Check existence
print("Does 'test.txt' exist?", fs:exists("test.txt"))
-- Create directory
fs:create_dir("my_folder")
-- Copy a file
fs:copy_file("test.txt", "my_folder\\copy_test.txt")
-- Move a file
fs:move_file("my_folder\\copy_test.txt", "my_folder\\moved_test.txt")
-- Delete a file or folder
fs:remove("my_folder\\moved_test.txt")
-- Get full absolute path
print("Full path:", fs:get_absolute_path("test.txt"))
-- List files (non-recursive)
local files = fs:list_dir(".", false)
for _, f in ipairs(files) do print(f) end
-- Check file size
print("File size:", fs:get_file_size("test.txt"), "bytes")
-- Get timestamps
print("Created at:", os.date("%Y-%m-%d %H:%M:%S", fs:get_creation_time("test.txt")))
-- Get temp directory
print("Temp path:", fs:get_temp_path())
-- Check file types
print("Is font?", fs:is_valid_font_file("arial.ttf"))
print("Is texture?", fs:is_valid_texture_file("image.png"))
local fs = FileSystem.new()
-- Check existence
print("Does 'test.txt' exist?", fs:exists("test.txt"))
-- Create directory
fs:create_dir("my_folder")
-- Copy a file
fs:copy_file("test.txt", "my_folder\\copy_test.txt")
-- Move a file
fs:move_file("my_folder\\copy_test.txt", "my_folder\\moved_test.txt")
-- Delete a file or folder
fs:remove("my_folder\\moved_test.txt")
-- Get full absolute path
print("Full path:", fs:get_absolute_path("test.txt"))
-- List files (non-recursive)
local files = fs:list_dir(".", false)
for _, f in ipairs(files) do print(f) end
-- Check file size
print("File size:", fs:get_file_size("test.txt"), "bytes")
-- Get timestamps
print("Created at:", os.date("%Y-%m-%d %H:%M:%S", fs:get_creation_time("test.txt")))
-- Get temp directory
print("Temp path:", fs:get_temp_path())
-- Check file types
print("Is font?", fs:is_valid_font_file("arial.ttf"))
print("Is texture?", fs:is_valid_texture_file("image.png"))