【发布时间】:2016-10-16 13:49:49
【问题描述】:
我正在尝试删除 Lua 中的非空目录,但没有成功,
我尝试了以下方法:
os.remove(path_to_dir)
得到了错误:Directory not empty 39
当path_to_dir中的文件数为39时
也试过了:
require ('lfs')
lfs.rmdir(path_to_dir)
并得到错误:目录不是空的'
值得一提的是,我做了chmod -R a+rX * 到path_to_dir
感谢您的帮助。
【问题讨论】:
-
os.execute('rm -rd "'..path_to_dir..'"')在 Linux 上 -
os.execute('rd /s/q "'..path_to_dir..'"')在 Windows 上