Rename Procedure


Rename Procedure

Class

Microsoft.VisualBasic.FileSystem

Syntax

     Rename(oldpath, newpath) 


oldpath (required; String)

The name and optional path of the file or directory to be renamed


newpath (required; String)

The new name and optional path to give to the file

Description

The Rename procedure renames a file or directory.

Usage at a Glance

  • If oldpath does not exist or is currently in use, or if newpath already exists or contains an invalid path, an error occurs.

  • If newpath and oldpath include different directory paths, the file or directory will be renamed and moved to the new location. Directories cannot be moved from one drive to another using this method.

  • Path information included in newpath and oldpath can include relative or absolute paths and can use the drive-letter or UNC format.

  • Wildcard characters cannot be used.

Version Differences

  • The Rename procedure is new to VB under .NET.

  • Visual Basic 2005 includes My.Computer.FileSystem.RenameFile and My.Computer.FileSystem.RenameDirectory methods that provide similar functionality.

See Also

FileCopy Procedure




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net