Created
February 14, 2012 05:36
-
-
Save perusio/1823926 to your computer and use it in GitHub Desktop.
Check if a file exists using nixio.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Playing with the nixio.fs library. | |
local nixiofs = require('nixio.fs') | |
-- Test if a file exists. | |
-- @param fname string | |
-- filename | |
-- @return boolean | |
-- true if file exists, false otherwise | |
-- | |
function file_exists(fname) | |
return nixiofs.stat(fname, 'type') == 'reg' | |
end -- file exists |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment