Type Library Revision Release 2024.3703 Keywords lfs, LuaFileSystem, files, file system See also LuaFileSystem Reference
LuaFileSystem provides functionality to perform various
To delete a directory or file, please refer to os.remove().
To rename a directory or file, please refer to os.rename().
local lfs = require( "lfs" ) -- Get raw path to the app documents directory local doc_path = system.pathForFile( "", system.DocumentsDirectory ) for file in lfs.dir( doc_path ) do -- "file" is the current file or directory name print( "Found file: " .. file ) end
local lfs = require( "lfs" ) -- Get raw path to the app temporary directory local temp_path = system.pathForFile( "", system.TemporaryDirectory ) -- Change current working directory local success = lfs.chdir( temp_path ) --returns true on success local new_folder_path if ( success ) then lfs.mkdir( "MyNewFolder" ) new_folder_path = lfs.currentdir() .. "/MyNewFolder" end