File rename
C # is a function without file rename. Generally, file. Remove () is used to rename, that is, file movement.
File. Remove (oldfilefullpath, newfilefullpath)
Do not change the path. Only change the file name.
For example:
File. Move ("d :\\ New Folder \ oldpicture.bmp", "d :\\ New Folder \ newpicture.bmp ");
If the path is not changed, the file data will not be moved, so that the size of the files is the same. The function is to rename the file!
Check whether the file is occupied
File. Remove (oldfilefullpath, newfilefullpath)
Make newfilefullpath equal to oldfilefullpath
For example:
Try
{
File. Move ("d :\\ New Folder \ textpicture.bmp", "d :\\ New Folder \ textpicture.bmp ");
}
Catch (exception ex)
{
MessageBox. Show (ex. Message );
}
If the file is in use, an error is reported. If the file is not in use, the file name will be the same because of the prefix and backend paths, and the file name will not change!
This allows you to check whether a file is occupied.
Csdn Link
Http://topic.csdn.net/u/20080819/15/4234292e-c4d9-4e29-b5b2-8ed2e352e54d.html? Seed = 1249513417