Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lua os.remove() folder results in 'Permission denied'

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.

enter image description here

What are the limitations with os.remove() in a Windows environment?

like image 798
chazjn Avatar asked Nov 23 '25 01:11

chazjn


1 Answers

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.

like image 114
hjpotter92 Avatar answered Nov 24 '25 22:11

hjpotter92



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!