Today, we learn how to delete a directory and move.
when your program must delete a directory and the files the directory contains.
In such cases, you just use the Directory class Delete method.
To delete a directory and, optionally, the files and subdirectories the directory contains, invoke the Delete method with the directory name and the
value True like Directory.Delete("DirectoryName", True)
If you do not want the Delete method to delete a directory that contains files or other subdirectories, invoke the method with the value False or simply omit the value like Directory.Delete("DirectoryName", False) or Directory.Delete("DirectoryName")
Also, you need to move a directory from the source path to the destination path
you only use the Directory class Move method
Directory.Move(sourcePath, DestinationPath)
for example : Directory.Move(strCreateDir, strMoveDir)
That's all.
when your program must delete a directory and the files the directory contains.
In such cases, you just use the Directory class Delete method.
To delete a directory and, optionally, the files and subdirectories the directory contains, invoke the Delete method with the directory name and the
value True like Directory.Delete("DirectoryName", True)
If you do not want the Delete method to delete a directory that contains files or other subdirectories, invoke the method with the value False or simply omit the value like Directory.Delete("DirectoryName", False) or Directory.Delete("DirectoryName")
Also, you need to move a directory from the source path to the destination path
you only use the Directory class Move method
Directory.Move(sourcePath, DestinationPath)
for example : Directory.Move(strCreateDir, strMoveDir)
That's all.
'Visual Basic .NET > Directory & File' 카테고리의 다른 글
How to use Directory Class to make a new directory (0) | 2008.06.30 |
---|