In this guide, we will discuss Erlang rename. This method is used to rename an existing file.
Syntax
rename(oldfilename,newfilename)
Parameters
- oldfilename − This is the original file name.
- newfilename − This is the name to which the file should be renamed to.
Return Value
A status on the rename operation. If this is successful, an {Ok} message will be displayed.
For example
-module(helloworld). -export([start/0]). start() -> io:fwrite("~p~n",[file:rename("Newfile.txt","Renamedfile.txt")]).
Output
The file Newfile.txt will be renamed to Renamedfile.txt.
Next Topic : Click Here
Pingback: Erlang - make_dir | Adglob Infosystem Pvt Ltd
Pingback: Erlang - File I/O | Adglob Infosystem Pvt Ltd