Delete a directory

Verified
Added by iNTERFACEWARE

Use os.fs.rmdir() to delete an empty directory, if the directory is not empty an error is returned

Source Code
   -- create and delete a directory
   os.fs.mkdir('MyTempDir')
   os.fs.stat('MyTempDir')
   
   -- remove (delete) the directory
   os.fs.rmdir('MyTempDir')  
   os.fs.stat('MyTempDir') -- stats no longer available
Description
Use os.fs.rmdir() to delete an empty directory, if the directory is not empty an error is returned
Usage Details

Use os.fs.rmdir() to delete an empty directory.

How to use the snippet:

  • Paste the code into your script