Try
function file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end
end
but note that this code only tests whether the file can be opened for reading.
More Related Contents:
- How do I check if a file exists in Java?
- What’s the de-facto way of reading and writing files in Rust 1.x?
- Write lines of text to a file in R
- Ant: How to execute a command for each file in directory?
- Deleting a file in VBA
- Reading comment lines correctly in an input file using Fortran 90
- Write extracted data to a file using jmeter
- File I/O in a Linux kernel module
- Append to a file in Go
- Why does a read-only open of a named pipe block?
- Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on
- How do I check whether a file exists without exceptions?
- Parsing CSV files in C#, with header
- Why is three-argument open calls with autovivified filehandles a Perl best practice?
- Java byte array contains negative numbers
- Batch Renaming of Files in a Directory
- How to delete a folder with files using Java
- Does HTML5 allow you to interact with local client files from within a browser
- Android SAF (Storage Access FrameWork): Get particular file Uri from TreeUri
- How to signify no more input for string ss in the loop while (cin >> ss)
- What is the rationale for fread/fwrite taking size and count as arguments?
- Read CSV file column by column
- How can I read large text files line by line, without loading them into memory? [duplicate]
- Writing data to a local text file with javascript
- How to save a base64 string as an image using ruby
- How to check if a file is gzip compressed?
- Change file to read-only mode in Python
- Iterating through a Lua table from C++?
- How do I remove lines of data in the middle of a text file with Ruby
- Read large CSV in java