This function moves a file from a source location to a destination location inside of a filesystem. This function is the fastest way to move data from one location to another.
bool translator.rename ( string srcPath, string dstPath )
- srcPath: a path to the source file
- dstPath: the path to the destination location where the source file should be moved to
This function returns true if the file pointed at by srcPath could be successfully moved to the new dstPath location, false otherwise.
This snippet moves a script file to another location.
-- Create a generic translator. local resRoot = fileCreateTranslator( "/" ); -- Move this script file into a directory called "collection" resRoot.rename( "thisScript.lua", "trash/thisScript.lua" );