Folder Operations in VB

Folder Operations in VB

There are also VB functions that allow you to rename, create and remove directories (called folders in Win 95/98). These are:

Name         Description
 
MkDir         Creates a directory
 
RmDir        Removes a directory
 
Name         Renames a directory
 

To create a directory, you use the MkDir function:

MkDir DirNameandPath

So,

MkDir “C:\testdir”

creates the directory testdir (so long as it does not already exist)

To remove a directory, you use the RmDir function:

RmDir DirNameandPath

So,

RmDir “C:\testdir”

removes the directory testdir (so long as it is empty)

To rename a directory, you use the Name Function:

Name OldNameandPath As NewNameandPath

So,

Name “C:\testdir” As “C:\testdir2″

Renames testdir as testdir2.

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.