I am trying to use os.remove()
to delete an empty folder in Windows using Lua but it just results in 'Permission Denied'. I can delete files with no problem.
However if I use os.execute()
to call rmdir
the folder does get deleted.
What are the limitations with os.remove()
in a Windows environment?
The os.remove
documentation states:
Deletes the file (or empty directory, on POSIX systems) with the given name. If this function fails, it returns
nil
, plus a string describing the error and the error code.
Windows is not POSIX compliant OS, therefore; exhibiting such a behaviour.
To get POSIX compatibility in Windows 7, you have to activate the Subsystem for UNIX-based applications (SUA / Interix) in Windows.