const TCHAR* <spanclass="arg">old_name</span>, <spanclass="c">/* [IN] Old object name */</span>
const TCHAR* <spanclass="arg">new_name</span><spanclass="c">/* [IN] New object name */</span>
);
</pre>
</div>
<divclass="para arg">
<h4>Parameters</h4>
<dlclass="par">
<dt>old_name</dt>
<dd>Pointer to a null-terminated string that specifies an existing <ahref="filename.html">file or sub-directory</a> to be renamed.</dd>
<dt>new_name</dt>
<dd>Pointer to a null-terminated string that specifies the new object name. The drive number specified in this string is ignored and one determined by <ttclass="arg">old_name</tt> is used instead.</dd>
</dl>
</div>
<divclass="para ret">
<h4>Return Values</h4>
<p>
<ahref="rc.html#ok">FR_OK</a>,
<ahref="rc.html#de">FR_DISK_ERR</a>,
<ahref="rc.html#ie">FR_INT_ERR</a>,
<ahref="rc.html#nr">FR_NOT_READY</a>,
<ahref="rc.html#ok">FR_NO_FILE</a>,
<ahref="rc.html#np">FR_NO_PATH</a>,
<ahref="rc.html#in">FR_INVALID_NAME</a>,
<ahref="rc.html#de">FR_DENIED</a>,
<ahref="rc.html#ex">FR_EXIST</a>,
<ahref="rc.html#wp">FR_WRITE_PROTECTED</a>,
<ahref="rc.html#id">FR_INVALID_DRIVE</a>,
<ahref="rc.html#ne">FR_NOT_ENABLED</a>,
<ahref="rc.html#ns">FR_NO_FILESYSTEM</a>,
<ahref="rc.html#tm">FR_TIMEOUT</a>,
<ahref="rc.html#lo">FR_LOCKED</a>,
<ahref="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
</p>
</div>
<divclass="para desc">
<h4>Description</h4>
<p>Renames a file or sub-directory and can also move it to other directory within the same logical drive. <em>Do not rename open objects</em> or directry table can be broken.</p>
</div>
<divclass="para comp">
<h4>QuickInfo</h4>
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_FS_MINIMIZE == 0</tt>.</p>
</div>
<divclass="para use">
<h4>Example</h4>
<pre>
<spanclass="c">/* Rename an object */</span>
f_rename("oldname.txt", "newname.txt");
<spanclass="c">/* Rename and move an object to other directory */</span>