- Removed a long-pending limitation that f_getcwd and double-dot .. in the path name did not work on the exFAT volume. - Fixed f_readdir cannot detect end of directory and it leads the application process into infinite loop. (appeared at R0.15b) - Fixed dot names with terminating separator or duplicated separator are rejected when LFN is not enabled.
		
			
				
	
	
		
			88 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			88 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 | |
| <html lang="en">
 | |
| <head>
 | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 | |
| <meta http-equiv="Content-Style-Type" content="text/css">
 | |
| <link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
 | |
| <title>FatFs - f_rename</title>
 | |
| </head>
 | |
| 
 | |
| <body>
 | |
| 
 | |
| <div class="para func">
 | |
| <h2>f_rename</h2>
 | |
| <p>The f_rename function renames and/or moves a file or sub-directory.</p>
 | |
| <pre>
 | |
| FRESULT f_rename (
 | |
|   const TCHAR* <span class="arg">old_name</span>, <span class="c">/* [IN] Old object name */</span>
 | |
|   const TCHAR* <span class="arg">new_name</span>  <span class="c">/* [IN] New object name */</span>
 | |
| );
 | |
| </pre>
 | |
| </div>
 | |
| 
 | |
| <div class="para arg">
 | |
| <h4>Parameters</h4>
 | |
| <dl class="par">
 | |
| <dt>old_name</dt>
 | |
| <dd>Pointer to the null-terminated string that specifies the existing <a href="filename.html">file or sub-directory</a> to be renamed.</dd>
 | |
| <dt>new_name</dt>
 | |
| <dd>Pointer to the null-terminated string that specifies the new object name. A drive number may be specified in this string but it is ignored and assumed as the same drive of the <tt class="arg">old_name</tt>. Any object with this name except <tt class="arg">old_name</tt> must not be exist, or the function fails with <tt>FR_EXIST</tt>.</dd>
 | |
| </dl>
 | |
| </div>
 | |
| 
 | |
| 
 | |
| <div class="para ret">
 | |
| <h4>Return Values</h4>
 | |
| <p>
 | |
| <a href="rc.html#ok">FR_OK</a>,
 | |
| <a href="rc.html#de">FR_DISK_ERR</a>,
 | |
| <a href="rc.html#ie">FR_INT_ERR</a>,
 | |
| <a href="rc.html#nr">FR_NOT_READY</a>,
 | |
| <a href="rc.html#ok">FR_NO_FILE</a>,
 | |
| <a href="rc.html#np">FR_NO_PATH</a>,
 | |
| <a href="rc.html#in">FR_INVALID_NAME</a>,
 | |
| <a href="rc.html#ex">FR_EXIST</a>,
 | |
| <a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
 | |
| <a href="rc.html#id">FR_INVALID_DRIVE</a>,
 | |
| <a href="rc.html#ne">FR_NOT_ENABLED</a>,
 | |
| <a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
 | |
| <a href="rc.html#tm">FR_TIMEOUT</a>,
 | |
| <a href="rc.html#lo">FR_LOCKED</a>,
 | |
| <a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
 | |
| </p>
 | |
| </div>
 | |
| 
 | |
| 
 | |
| <div class="para desc">
 | |
| <h4>Description</h4>
 | |
| <p>Renames a file or sub-directory and can also move it to another directory in the same volume. The file to be renamed must not be an open file, or <em>the FAT volume can be collapsed</em>. Such the wrong file renaming is rejected safely when <a href="appnote.html#dup">file lock function</a> is enabled.</p>
 | |
| <p>Any sub-directory in the current directory path should not be renamed. It will be rejected on the exFAT volume but succeeds on the FAT/FAT32 volume.</p>
 | |
| <p><em>Remark: Be careful in moving a sub-directory. The sub-directory must not be moved into itself and any sub-directory in it, or the moved sub-directory will be lost.</em></p>
 | |
| </div>
 | |
| 
 | |
| 
 | |
| <div class="para comp">
 | |
| <h4>QuickInfo</h4>
 | |
| <p>Available when <tt><a href="config.html#fs_readonly">FF_FS_READONLY</a> == 0</tt> and <tt><a href="config.html#fs_minimize">FF_FS_MINIMIZE</a> == 0</tt>.</p>
 | |
| </div>
 | |
| 
 | |
| 
 | |
| <div class="para use">
 | |
| <h4>Example</h4>
 | |
| <pre>
 | |
|     <span class="c">/* Rename an object in the default drive */</span>
 | |
|     <em>f_rename</em>("oldname.txt", "newname.txt");
 | |
| 
 | |
|     <span class="c">/* Rename an object in the drive 2 */</span>
 | |
|     <em>f_rename</em>("2:oldname.txt", "newname.txt");
 | |
| 
 | |
|     <span class="c">/* Rename an object and move it into another directory in the drive */</span>
 | |
|     <em>f_rename</em>("log.txt", "old/log0001.txt");
 | |
| </pre>
 | |
| </div>
 | |
| 
 | |
| 
 | |
| <p class="foot"><a href="../index.html">Return</a></p>
 | |
| </body>
 | |
| </html>
 |