[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Create Directory with DirectoryInfo class

Posted on 2003-11-11
4
Medium Priority
?
605 Views
Last Modified: 2010-05-18
Hi,

   I am using the DirectoryInfo class to create directories. However there is a 260 character limitations to the length of
   the directory name which I maxing out on. Any way around this ?



Thanks


Robert
0
Comment
Question by:rogaut1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 22

Expert Comment

by:_TAD_
ID: 9726044


What kind of directory has a name that is more than 260 characters?!?
(hmm... and I thought windows set a limit at 254 chars... odd that .Net lets you add a few more.  I could be wrong though.)


At any rate, I am going to guess that you are NOT creating a directory name of 260+ characters, but are in fact trying to create a subdirectory several directories deep.

Assuming that is the case, you could get to 260 characters pretty fast.


If this is the case, you do not want to use DiretoryInfo class.  This class is geared for Instances of directories.


use this code:

Directory.CreateDirectory(strAReallyLongDirectoryStructure);
0
 
LVL 22

Expert Comment

by:_TAD_
ID: 9726082


Ack!


Ok... I tried out my own code and got the same error.

It looks like you'll have to do it recursively in order to get it done.
0
 
LVL 22

Accepted Solution

by:
_TAD_ earned 500 total points
ID: 9726158


Turns out it is a Windows limitation


Try doing it manually and you'll get all kinds of errors.

C:\temp\subFolderOrDirectoryWithReallyLongName\subFolderOrDirectoryWithReallyLongName\subFolderOrDirectoryWithReallyLongName\subFolderOrDirectoryWithReallyLongName\subFolderOrDirectoryWithReallyLongName


works just fine.


C:\temp\subFolderOrDirectoryWithReallyLongName\subFolderOrDirectoryWithReallyLongName\subFolderOrDirectoryWithReallyLongName\subFolderOrDirectoryWithReallyLongName\subFolderOrDirectoryWithReallyLongName\subFolderOrDirectoryWithReallyLongName


Throws an error in windows and it was really easy to test manually.

0
 
LVL 2

Author Comment

by:rogaut1
ID: 9726200
Thanks for your help !

I will have to convert the names I guess....


Robert
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question