473,765 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Directory.Creat eDirectory

Tom
This is really weird, but I have the following code:

private static readonly string mString = "tempUnzipD ir" +
Path.DirectoryS eparatorChar;

....

public static string ExtractToTempLo cation(string aZip)
{
try
{
string tmp = Path.GetTempPat h() + mString;
Directory.Creat eDirectory(tmp) ;
// Extract the zip file
}
catch(Exception e)
{
}
}

The code above creates a temporary directory fine on my dev machine (Vista),
but will not create a temp directory on my server (server 2K3 R2) when I
move the code over the to server. I have some logging enabled that isn't
shown in the code above, and it is definately pointing to the correct
location of the temp directory to be created. Even more weird is that the
call to Directory.Creat eDirectory(tmp) ; does not throw any type of exception
on the server. It just keeps executing as if it worked correctly. Does
anybody have any ideas why this isn't working?

Thanks.

Jul 9 '08 #1
4 2571
Tom
Even more weird, if I change the code to this:
private static readonly string mString = "tempUnzipD ir" +
Path.DirectoryS eparatorChar + "anotherDir " + Path.DirectoryS eparatorChar;

....

public static string ExtractToTempLo cation(string aZip)
{
try
{
string tmp = Path.GetTempPat h() + mString;
Directory.Creat eDirectory(tmp) ;
// Extract the zip file
}
catch(Exception e)
{
}
}

I see the directory "tempUnzipD ir" get created under the administrator's
temporary directory. However, the directory [administrator's temp
path]\tempUnzipDir\a notherDir does not get created. WTH??!!!

"Tom" <jo***********@ hotmail.comwrot e in message
news:BD******** *************** ***********@mic rosoft.com...
This is really weird, but I have the following code:

private static readonly string mString = "tempUnzipD ir" +
Path.DirectoryS eparatorChar;

...

public static string ExtractToTempLo cation(string aZip)
{
try
{
string tmp = Path.GetTempPat h() + mString;
Directory.Creat eDirectory(tmp) ;
// Extract the zip file
}
catch(Exception e)
{
}
}

The code above creates a temporary directory fine on my dev machine
(Vista), but will not create a temp directory on my server (server 2K3 R2)
when I move the code over the to server. I have some logging enabled that
isn't shown in the code above, and it is definately pointing to the
correct location of the temp directory to be created. Even more weird is
that the call to Directory.Creat eDirectory(tmp) ; does not throw any type
of exception on the server. It just keeps executing as if it worked
correctly. Does anybody have any ideas why this isn't working?

Thanks.
Jul 9 '08 #2
What type of application are you doing? When you say move code to "server",
does that mean a ASP.NET application, a Windows service application or a
desktop application? Without knowing which user account is used to run your
app, it is hard to tell what is wrong. But it ceratinly sounds like you have
permission problem. As for the code not throwing exception, if the code you
show is the real code, then of course the code does throw exception and is
caught in catch(){} block. However, since you did nothng in the "catch..."
block, the code continues. That is, if you use try...catch... and do nothing
when exception ia caught, that is equal to ignorig the exception and the
code would continue counting on your luck to finish.

"Tom" <jo***********@ hotmail.comwrot e in message
news:BD******** *************** ***********@mic rosoft.com...
This is really weird, but I have the following code:

private static readonly string mString = "tempUnzipD ir" +
Path.DirectoryS eparatorChar;

...

public static string ExtractToTempLo cation(string aZip)
{
try
{
string tmp = Path.GetTempPat h() + mString;
Directory.Creat eDirectory(tmp) ;
// Extract the zip file
}
catch(Exception e)
{
}
}

The code above creates a temporary directory fine on my dev machine
(Vista), but will not create a temp directory on my server (server 2K3 R2)
when I move the code over the to server. I have some logging enabled that
isn't shown in the code above, and it is definately pointing to the
correct location of the temp directory to be created. Even more weird is
that the call to Directory.Creat eDirectory(tmp) ; does not throw any type
of exception on the server. It just keeps executing as if it worked
correctly. Does anybody have any ideas why this isn't working?

Thanks.
Jul 9 '08 #3
Tom
I found the problem. It was a sync issue. This was a plug-in for a Windows
service. Another plug-in was deleting temp directories.

Sorry to bug everyone.
"Norman Yuan" <Fa******@FakeE mail.Notwrote in message
news:eR******** ******@TK2MSFTN GP03.phx.gbl...
What type of application are you doing? When you say move code to
"server", does that mean a ASP.NET application, a Windows service
application or a desktop application? Without knowing which user account
is used to run your app, it is hard to tell what is wrong. But it
ceratinly sounds like you have permission problem. As for the code not
throwing exception, if the code you show is the real code, then of course
the code does throw exception and is caught in catch(){} block. However,
since you did nothng in the "catch..." block, the code continues. That is,
if you use try...catch... and do nothing when exception ia caught, that is
equal to ignorig the exception and the code would continue counting on
your luck to finish.

"Tom" <jo***********@ hotmail.comwrot e in message
news:BD******** *************** ***********@mic rosoft.com...
>This is really weird, but I have the following code:

private static readonly string mString = "tempUnzipD ir" +
Path.Directory SeparatorChar;

...

public static string ExtractToTempLo cation(string aZip)
{
try
{
string tmp = Path.GetTempPat h() + mString;
Directory.Creat eDirectory(tmp) ;
// Extract the zip file
}
catch(Exceptio n e)
{
}
}

The code above creates a temporary directory fine on my dev machine
(Vista), but will not create a temp directory on my server (server 2K3
R2) when I move the code over the to server. I have some logging enabled
that isn't shown in the code above, and it is definately pointing to the
correct location of the temp directory to be created. Even more weird is
that the call to Directory.Creat eDirectory(tmp) ; does not throw any type
of exception on the server. It just keeps executing as if it worked
correctly. Does anybody have any ideas why this isn't working?

Thanks.
Jul 9 '08 #4
tim
Try using System.IO.Path. Combine() method instead of string concat.

"Tom" <jo***********@ hotmail.comwrot e in message
news:61******** *************** ***********@mic rosoft.com...
Even more weird, if I change the code to this:
private static readonly string mString = "tempUnzipD ir" +
Path.DirectoryS eparatorChar + "anotherDir " + Path.DirectoryS eparatorChar;

...

public static string ExtractToTempLo cation(string aZip)
{
try
{
string tmp = Path.GetTempPat h() + mString;
Directory.Creat eDirectory(tmp) ;
// Extract the zip file
}
catch(Exception e)
{
}
}

I see the directory "tempUnzipD ir" get created under the administrator's
temporary directory. However, the directory [administrator's temp
path]\tempUnzipDir\a notherDir does not get created. WTH??!!!

"Tom" <jo***********@ hotmail.comwrot e in message
news:BD******** *************** ***********@mic rosoft.com...
>This is really weird, but I have the following code:

private static readonly string mString = "tempUnzipD ir" +
Path.Directory SeparatorChar;

...

public static string ExtractToTempLo cation(string aZip)
{
try
{
string tmp = Path.GetTempPat h() + mString;
Directory.Creat eDirectory(tmp) ;
// Extract the zip file
}
catch(Exceptio n e)
{
}
}

The code above creates a temporary directory fine on my dev machine
(Vista), but will not create a temp directory on my server (server 2K3
R2) when I move the code over the to server. I have some logging enabled
that isn't shown in the code above, and it is definately pointing to the
correct location of the temp directory to be created. Even more weird is
that the call to Directory.Creat eDirectory(tmp) ; does not throw any type
of exception on the server. It just keeps executing as if it worked
correctly. Does anybody have any ideas why this isn't working?

Thanks.
Jul 26 '08 #5

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

Similar topics

1
15890
by: MAF | last post by:
How do I create a directory inside C#?
1
2423
by: Daniel | last post by:
If I call CreateDirectory(\\\\devDriveA\\foo\\bar\\a\\b\\c) and \\devDriveA\foo\bar already exists then sub directories a\b\c don't get created. When I use CreateDirectory on my own file system, e.g. CreateDirectory("c:\\a\\b\\c"); it works fine. Is there something that I must do to get CreateDirectory to work on network drives?
1
1536
by: H.B. | last post by:
Hi, Is there a way to avoid conflicts between CreateDirectory() (from API) and Directory::CreateDirectory(). The other functions from Directory class works(Exists() as example). It seems to be caused by the inclusion of "windows.h" ... but I need it. I already tried the System::IO::Directory::CreateDirectory() typo. Any ideas ?
3
2293
by: James Coleman | last post by:
Hello, The following error is appearing when attempting to create a directory using the availale system.io methods: System.IO.DirectoryNotFoundException: Could not find a part of the path "D:\". at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path) at System.IO.Directory.CreateDirectory(String path) at TestVBProject.createdirectorytest.Page_Load(Object...
2
2202
by: Paul Bromley | last post by:
How can I create a directory within a shared ntwork directory?? sServerName - is the Server name "\Docs" - is the shared directory "\Others" - is the directory to create. The following does not work, although I can through code open and copy files from "\Docs"
23
2435
by: **Developer** | last post by:
Is there an easy way to copies all files in a directory into another directory? What about coping subdirectories too? Thanks in advance for any info
2
3954
by: CCLeasing | last post by:
If (Directory.Exists(@"c:\indigo\" + txtOfficial + @"\" + comOffice.Text + @"\" + numTerm.Value.ToString())) { storereport(); } else { Directory.CreateDirectory(@"c:\indigo\" + txtOfficial + @"\" + comOffice.Text + @"\" + numTerm.Value.ToString());
2
8694
by: Toolsmith | last post by:
The following code: C# code: Directory.CreateDirectory("D:\\somewhere\\somewhereelse\\here\\") works, but the following does flags the error: An unhandled exception of type 'System.NotSupportedException' occurred in mscorlib.dll
4
2825
by: Robert | last post by:
Greetings New to Visual Studio 2008. Always us VB6.0 SP5. I am trying to copy files from A to B. I select a directory, and copy files. Works ok, but it does not create the directory first. snippet. Private Sub cmdTo_Click(ByVal sender As System.Object, ByVal e As
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10161
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...
1
9955
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
8831
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
7378
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
6649
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();...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.