os.rename
Lua function

os.rename

Summary

Renames a file

Prototype

ok, message = os.rename (oldname, newname)



Description

Renames a file. On success, returns true.

If it cannot, it returns nil followed by an error message.


os.rename("test.txt", "test2.txt") --> true
os.rename("test.txt", "test2.txt") --> nil, test.txt: File exists 



See Also ...

Topics

DOC_lua_base Lua base functions
DOC_lua_bc Lua bc (big number) functions
DOC_lua_bit Lua bit manipulation functions
DOC_lua_coroutines Lua coroutine functions
DOC_lua_debug Lua debug functions
DOC_lua_io Lua io functions
DOC_lua_math Lua math functions
DOC_lua_os Lua os functions
DOC_lua_package Lua package functions
DOC_lua_rex Lua PCRE regular expression functions
DOC_lua Lua script extensions
DOC_lua_string Lua string functions
DOC_lua_tables Lua table functions
DOC_lua_utils Lua utilities
DOC_scripting Scripting

Lua functions

LUA_os.clock os.clock (Amount of CPU time used)
LUA_os.date os.date (Formats a date/time string)
LUA_os.difftime os.difftime (Calculates a time difference in seconds)
LUA_os.execute os.execute (Executes an operating system command)
LUA_os.exit os.exit (Attempts to terminate the process)
LUA_os.getenv os.getenv (Returns an operating system environment variable)
LUA_os.remove os.remove (Deletes a file)
LUA_os.setlocale os.setlocale (Sets the current locale to the supplied locale)
LUA_os.time os.time (Returns the current time or calculates the time in seconds from a table)
LUA_os.tmpname os.tmpname (Returns a name for a temporary file)

(Help topic: lua=os.rename)

DOC_contents Documentation contents page