Test for file existence and permissions

Verified
Added by iNTERFACEWARE

Use os.fs.access() to check if a file exists, and to verify the permissions

Source Code
   -- test if a file exists
   local ReadWriteable = os.fs.access('IguanaConfiguration.xml')   
   
   -- test if you can read a file
   local ReadWriteable = os.fs.access('IguanaConfiguration.xml', 'r')   
   
   -- test if you can write a file
   local ReadWriteable = os.fs.access('IguanaConfiguration.xml', 'w')   
   
   -- test if you can read and write a file
   local ReadWriteable = os.fs.access('IguanaConfiguration.xml', 'rw')   
   
   -- test if you can execute a file
   local ReadWriteable = os.fs.access('IguanaConfiguration.xml', 'x')
Description
Use os.fs.access() to check if a file exists, and to verify the permissions
Usage Details

Use os.fs.access() to check if a file exists, and to verify permissions.

How to use the snippet:

  • Paste the desired access verification code into your script