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.
