본문 바로가기
Visual Basic .NET/Directory & File

how to delete, move directory

by edupicker(체르니) 2008. 6. 30.
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.