How to create a folder in Java

To create a folder in Java you can use on of these 2 Methods

Sample Java

boolean done = (new File("directoryName")).mkdir();  // all ancestor directories must exist!
if (!done) {  
    // failed ()  
}  

Sample Java

boolean done = (new File("directoryName")).mkdirs(); // all directories will be created   
if (!done) {  
    // failed  
}  

Please rate this snippet

How to create a folder in C# and VB.NET

To create a folder in C# and VB.NET you can use the following snippet.

Sample C#

try
{
	const string path = @"C:\Users\Codesnippets\Desktop\Testfolder\Test1\Test2";
	Directory.CreateDirectory(path);
}
catch (Exception ex)
{
	//handle the exception your way
}

Sample VB.NET

Try
	Const  path As String = "C:\Users\Codesnippets\Desktop\Testfolder\Test1\Test2"
	Directory.CreateDirectory(path)
Catch ex As Exception
        'handle the exception your way
End Try

Please rate this snippet

How to open a file or folder using VBA

To open a file or folder using VBA you can sue the follwing snippet.
This snippet should also work in VB6.

Sample VBA

Dim path As String
Dim explorerPath As String

explorerPath = Environ$("WINDIR") + "\Explorer.exe "
path = "C:\Users\Codesnippets\Desktop\test"
Call Shell(explorerPath + Chr(34) + path + Chr(34), vbNormalFocus)

Please rate this snippet

How to delete a file or folder in Powershell

To delete a file or Folder in Powershell you can use the following snippet.

Sample Powershell

if you want to delete a file use

remove-item -path "C:\Users\Codesnippets\Desktop\Test.xml" -force -recurse

if you want to delete a folder use

remove-item -path "C:\Users\Codesnippets\Desktop\Folder1" -force -recurse

for more informations see Using the Remove-Item Cmdlet

Please rate this snippet