473,386 Members | 2,050 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,386 software developers and data experts.

create/rename a directory

134 100+
I am trying to make a program with a textbox in which you can put a name and it must use that name to create a directory with the name I've put in. I've already found some codes like

Expand|Select|Wrap|Line Numbers
  1. DirectoryInfo di = Directory.CreateDirectory(Environment.CurrentDirectory);
  2. System.IO.Directory.Move(@"C:\Nieuwe map", @"C:\savetext.Text");
.

Now comes a problem that I am getting the idea that the first line doesn't create a directory and that I don't know how to say that the 2nd line needs to look to my textbox. "savetext" is the name of my textbox.
Apr 7 '11 #1
1 1673
GaryTexmo
1,501 Expert 1GB
The first line is correct, you're just giving it input of a directory that already exists. Consider what Environment.CurrentDirectory is... output it to the console or with a message box if you're not sure.

The second line also has issues. For the first parameter, the source directory, I'm not sure if you can put a space like that. You might need to surround the directory name in quotes, but this is something you can look into :) More importantly, the second parameter, the destination directory, is actually the string "c:\savetext.Text". If you want to use your text box, don't put it in quotes (with the C:\). If you want to include the c:\, you need to concatenate the strings...

[quote]@"C:\" + savetext.Text[/code]

Hopefully that helps you :)
Apr 7 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: jiing | last post by:
Given IP and Administrator's password, how to create a directory and change its privilege remotely ? (remote computer is windows 2003) In fact, I just want to use web to assist creating share...
6
by: Rajesh N Thipse | last post by:
Hi, Files can be created using _creat. Similarly, is there a function to create a directory? ~Rajesh
1
by: MAF | last post by:
How do I create a directory inside C#?
4
by: ad | last post by:
We can use System.IO namespace to create a directory in win-base program. But when I want to create a directory in the server with web-base program, System.IO namespace can't work? How can I...
1
by: Russell Mangel | last post by:
Hi, I am trying to create a directory on my disk wihich is 300+ characters long. My program does not work, can you make it go? I am using VS2003 C++. Russell Mangel, Las Vegas, NV // I have...
1
by: יוני גולדברג | last post by:
Hi, While trying to create new directory i recieve the following error message: "System.IO.DirectoryNotFoundException: Could not find a part of the path "\\premfs16\sites". The path exists, even...
9
by: Martin Jørgensen | last post by:
Hi, I guess in every beginners C-book it writes about how to declare a filepointer fp and how to create a file (at least in mine)...... Like here: FILE * fp; fp = fopen("output_file.txt",...
0
by: roger_27 | last post by:
hey, I need to know how to create a directory in my web service application path. I have files uploading to a directory I want it to create called "Uploaded_files"... now I know that I can get...
6
by: coolestavi007 | last post by:
Hi, I have to create directories on the FTP server. I have tried directory.exists but it doesnt work.Any other way to create directory on the server.Please help me.
6
by: tvnaidu | last post by:
I am trying to create a directory "/log" in linux in below file, it is not creating, I commented windows call and added linux call ro create /log dir. #define DEFAULT_LOG_DIR "/log" void...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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.