Removes a file or empty directory.
success = love.filesystem.remove( name )
string name
boolean success
The directory must be empty before removal or else it will fail. Simply remove all files and folders in the directory beforehand.
If the file exists in the .love but not in the save directory, it returns false
as well.
An opened File prevents removal of the underlying file. Simply close the File to remove it.
Create a bunch of folders in the save folder and remove them and any file they may contain as soon as the game is quit.
function love.load() local dir = 'a'; for _ = 1, 10 do dir = dir .. '/a'; end love.filesystem.createDirectory(dir); end function love.quit() local function recursivelyDelete(item, depth) if love.filesystem.isDirectory(item) then for _, child in pairs(love.filesystem.getDirectoryItems(item)) do recursivelyDelete(item .. '/' .. child, depth + 1); love.filesystem.remove(item .. '/' .. child); end elseif love.filesystem.isFile(item) then love.filesystem.remove(item); end love.filesystem.remove(item) end recursivelyDelete('a', 0); end
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/love.filesystem.remove