FIL Library
You can import this library and get out of the box simple file operations. See how to Import a Library.
This is a simple helper library great for basic operations like reading a file, writing a file and has a few other utilities like getting a file extension and file name from a full file name.
For example, this is how you would read in content from a file and write it to another:
local Content = FILread("sourceContent.lua");
FILwrite("life.lua", Content)
Each function has help built in.
The main source file is here: https://bitbucket.org/interfaceware/fil/src/main/FILreadWrite.lua. It is part of the iNTERFACEWARE Core Collection.
If you want to know more, take a look at How the FIL library works.