In Lua, LFS. mkdir LFS. rmdir can only be used for a single directory, and LFS. rmdir cannot be used to clear folders.
So I want to use OS .exe cute
Recursive Directory creation is as follows:
OS .exe cute ("mkdir ooxx \ ooxx) -- Windows
OS .exe cute ("mkdir-P ooxx/ooxx) -- UNIX, Linux like
Clear the directory as follows:
OS .exe cute ("del ooxx \) -- Windows
OS .exe cute ("RM-RF ooxx \) -- UNIX, Linux like
The job can be implemented normally, but it is uncomfortable to use OS .exe cute.
If the OS .exe cute statement executed has output, it will interfere with the console, leading to confusion in subsequent output.
To avoid this problem, I had to manually create a directory recursively, clear the directory as a traversal, and then remove them one by one.
I am using Lua LFS to traverse
Although the requirements have been met, I still want to ask if there are any better solutions.