473,385 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How do I create a folder?

I have tried:

System.IO.File.Create("C:\FolderName")

It does not create a folder. Any ideas without using the File System Object?

Rachel

Nov 21 '05 #1
4 1572

August 8, 2004

You have to create a IO.DirectoryInfo(path) with the path being the
parent of the folder you want. So if you wanted to create the folder:
"c:\program files\MyNewFolder", you would create a
DirectoryInfo("c:\program files") object. Then you call the
CreateSubDirectory(newfoldername) method of the DirectoryInfo object...

Private Sub Button1_Click(...)
Dim iDirectory as New System.IO.DirectoryInfo("c:\program files\")
iDirectory.CreateSubDirectory("MyNewFolder")
End Sub

This would then create the MyNewFolder in C:\Program Files\.
Have a nice day!
Joseph
"Rachel" wrote:
I have tried:

System.IO.File.Create("C:\FolderName")

It does not create a folder. Any ideas without using the File System Object?

Rachel

Nov 21 '05 #2
With Deft Fingers, Rachel <Ra****@discussions.microsoft.com> wrote:
System.IO.File.Create("C:\FolderName")
It does not create a folder. Any ideas without using the File System Object?


Try this (or just take out what you want):

Dim TempDir As String
TempDir = "C:\FolderName"
If Directory.Exists(TempDir) Then
Exit Sub
Else : MkDir(TempDir)
End If
The MkDir is what you want.

Regards,

Bruce
Nov 21 '05 #3
Hi,

System.IO.Directory.CreateDirectory("C:\New Directory")

Ken

--------------------

"Rachel" <Ra****@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com...
I have tried:

System.IO.File.Create("C:\FolderName")

It does not create a folder. Any ideas without using the File System
Object?

Rachel
Nov 21 '05 #4
This works for me...

----------------------------------------------------

Option Explicit On
Option Strict On

'

Imports System.IO
Imports System.IO.Directory

'

Module PathModule

'

Friend Function CreatePath(ByVal thePath As String) As Boolean

Dim theDirectory As DirectoryInfo, _
thePathOrNot As Boolean

'

thePathOrNot = Exists(thePath)

If (Not (thePathOrNot)) Then

'

theDirectory = CreateDirectory(thePath)

With theDirectory

'

thePathOrNot = .Exists

End With

End If

'

Return (thePathOrNot)

End Function

End Module
Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: David Webb | last post by:
The problem started when the Working Folder for a project was somehow set to the folder of another project. I set the correct working folder in VSS and deleted the .vbproj files that had been...
4
by: I_AM_DON_AND_YOU? | last post by:
There is one more problem I am facing but didn't get the solution. In my Setup Program I am not been able to create 2 things (when the program is intalled on the client machine ) : (1) create...
6
by: jzdeng | last post by:
Hi, All I use VS 2005 to create a web service. The web service is used to create a sheared folder. It works fine we I run it from VS 2005. But, when I move it to inetpub, it does not work...
8
by: Paw | last post by:
Greetings. I use asp. what I need is is when a visitor comes to the site, I need it to check the host name. if "www.hometowndigest.com" is the host, then check a folder named "something" and if...
8
by: barb | last post by:
So that the world at large benefits from our efforts, here is one fully documented way to use Windows Irfanview freeware to create thumbnail web galleries (http://www.irfanview.com). STEP 1:...
0
by: 1333 | last post by:
I need to create a new folder every time the upload folder has 10 files uploaded to it. So when folder1 has 10 files, folder2 is created and becomes the upload folder, and when it has 10 files...
7
by: Wiebe Tijsma | last post by:
Hi, I'm using C# + webDAV to create a draft message to be sent in a user's Drafts folder. I can create the message successfully, however when I open the message in outlook, it doesn't show...
10
by: kai | last post by:
Hi, All I am trying to create a file folder for any login user, and create sub folders for the user on a web page. After the user login again, he can only sees his own folder on the Web page. I am...
4
by: Alan Mailer | last post by:
Again, I'm new to VB.net and there is something I need help with: Like (I assume) many of us, over time I want to be able to create some VB.net classes that I might want to use in more than one...
5
by: krasman | last post by:
hi everyone, i hope you might help me on this one. i need to create a contact in a exchange public folder using dotnet (vb or c#) and exchange 2003, without using outlook object model. i'm...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.