Syntax |
Name oldfile$ As newfile$ |
Description |
Renames a file. |
Comments |
Each parameter must specify a single filename. Wildcard characters such as * and ? are not allowed. Some platforms allow naming of files to different directories on the same physical disk volume. For example, the following rename will work under Windows: Name "c:\samples\mydoc.txt" As "c:\backup\doc\mydoc.bak" You cannot rename files across physical disk volumes. For example, the following will error under Windows: Name "c:\samples\mydoc.txt" As "a:\mydoc.bak" 'This will error! To rename a file to a different physical disk, you must first copy the file, then erase the original: FileCopy
"c:\samples\mydoc.txt","a:\mydoc.bak" 'Make a copy |
Example |
This example creates a file called test.dat and then renames it to test2.dat. Sub Main() On Error Resume Next Else |
See Also |
N |