473,657 Members | 2,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I create a folder?

I have tried:

System.IO.File. Create("C:\Fold erName")

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

Rachel

Nov 21 '05 #1
4 1582

August 8, 2004

You have to create a IO.DirectoryInf o(path) with the path being the
parent of the folder you want. So if you wanted to create the folder:
"c:\program files\MyNewFold er", you would create a
DirectoryInfo(" c:\program files") object. Then you call the
CreateSubDirect ory(newfolderna me) method of the DirectoryInfo object...

Private Sub Button1_Click(. ..)
Dim iDirectory as New System.IO.Direc toryInfo("c:\pr ogram files\")
iDirectory.Crea teSubDirectory( "MyNewFolde r")
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:\Fold erName")

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

Rachel

Nov 21 '05 #2
With Deft Fingers, Rachel <Ra****@discuss ions.microsoft. com> wrote:
System.IO.File .Create("C:\Fol derName")
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:\FolderN ame"
If Directory.Exist s(TempDir) Then
Exit Sub
Else : MkDir(TempDir)
End If
The MkDir is what you want.

Regards,

Bruce
Nov 21 '05 #3
Hi,

System.IO.Direc tory.CreateDire ctory("C:\New Directory")

Ken

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

"Rachel" <Ra****@discuss ions.microsoft. com> wrote in message
news:F7******** *************** ***********@mic rosoft.com...
I have tried:

System.IO.File. Create("C:\Fold erName")

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.Direc tory

'

Module PathModule

'

Friend Function CreatePath(ByVa l 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
11032
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 created in the wrong folder on the hard drive. Before I discovered these files, .NET kept trying to create a new project with _1 following the project name. Deleting those files corrected that problem. I deleted the Virtual Directory, rebooted, and...
4
4407
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 shortcut to my program/utility (2) Entry in Windows' Start --> Program Menu. Actually in my VB.Net solution I have two projects (1) MYPROGRAM (2) MYPROGRAM_INSTALLER. MYPROGRAM is a "Windows Application". MYPROGRAM_INSTALLER is a "SetUp Wizard"...
6
3928
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 (folder is created but is not shared). Does anyone know how to solve this problem? Thanks.
8
2566
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 the folder does not exsist, create folder "www" and then copy folder "temp" and its contents. If the folder "www" is there, look in it, check to see if the files in folder "temp" are in there, if not, copy the files that are not from folder...
8
20354
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: Start with original thumbnails & two empty sub directories STEP 2: Create smaller versions of the originals for one sub directory STEP 3: Create thumbnail version of the originals the other sub directory STEP 4: Create an index.html pointing to the...
0
1372
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 uploaded to it folder3 is created and so on..... Problem is that my code creates all the next folders all at once. I need it to create the next folder when it is required. i.e. when the previous folder has reached 10 files. If anyone can explain...
7
3477
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 the 'send' button, (only 'reply' etc as if it was a received message). I'm using exchange explorer to see the difference in webDAV properties
10
14285
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 planning to use VB2005 or C#. I look the help files and searched on the web, I cannot find the answer. Is this possble in ASP.NET 2.0? Thanks
4
4459
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 Project. So let's say I've created a Folder called "MyVBNet Classes" to hold these general-use VB.Net class files that I will eventually associate with various Projects I create. Now let's imagine I've created a class called "MyClass.vb" that...
5
3565
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 searching for a few hours and can't find a clear example on how to do it. i've already seen code blocks using webdav, directory services, but always related with creating active directory users or mail enabling users, not exactly what i'm looking for....
0
8315
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8829
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8508
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6172
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4164
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.