PC Review


Reply
Thread Tools Rate Thread

Re: Directory.CreateDirectory

 
 
Tom
Guest
Posts: n/a
 
      9th Jul 2008
Even more weird, if I change the code to this:
private static readonly string mString = "tempUnzipDir" +
Path.DirectorySeparatorChar + "anotherDir" + Path.DirectorySeparatorChar;

....

public static string ExtractToTempLocation(string aZip)
{
try
{
string tmp = Path.GetTempPath() + mString;
Directory.CreateDirectory(tmp);
// Extract the zip file
}
catch(Exception e)
{
}
}

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



"Tom" <(E-Mail Removed)> wrote in message
news:BDD91C65-40DD-433F-8932-(E-Mail Removed)...
> This is really weird, but I have the following code:
>
> private static readonly string mString = "tempUnzipDir" +
> Path.DirectorySeparatorChar;
>
> ...
>
> public static string ExtractToTempLocation(string aZip)
> {
> try
> {
> string tmp = Path.GetTempPath() + mString;
> Directory.CreateDirectory(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.CreateDirectory(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.
>


 
Reply With Quote
 
 
 
 
tim
Guest
Posts: n/a
 
      26th Jul 2008
Try using System.IO.Path.Combine() method instead of string concat.

"Tom" <(E-Mail Removed)> wrote in message
news:61B35E73-2802-481A-BF57-(E-Mail Removed)...
> Even more weird, if I change the code to this:
> private static readonly string mString = "tempUnzipDir" +
> Path.DirectorySeparatorChar + "anotherDir" + Path.DirectorySeparatorChar;
>
> ...
>
> public static string ExtractToTempLocation(string aZip)
> {
> try
> {
> string tmp = Path.GetTempPath() + mString;
> Directory.CreateDirectory(tmp);
> // Extract the zip file
> }
> catch(Exception e)
> {
> }
> }
>
> I see the directory "tempUnzipDir" get created under the administrator's
> temporary directory. However, the directory [administrator's temp
> path]\tempUnzipDir\anotherDir does not get created. WTH??!!!
>
>
>
> "Tom" <(E-Mail Removed)> wrote in message
> news:BDD91C65-40DD-433F-8932-(E-Mail Removed)...
>> This is really weird, but I have the following code:
>>
>> private static readonly string mString = "tempUnzipDir" +
>> Path.DirectorySeparatorChar;
>>
>> ...
>>
>> public static string ExtractToTempLocation(string aZip)
>> {
>> try
>> {
>> string tmp = Path.GetTempPath() + mString;
>> Directory.CreateDirectory(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.CreateDirectory(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.
>>

>


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Directory.CreateDirectory Tom Microsoft Dot NET 4 26th Jul 2008 11:35 AM
Directory.CreateDirectory followed by Directory.Move Matt MacDonald Microsoft ASP .NET 0 30th Jan 2008 08:34 PM
Directory.CreateDirectory() issue Ken Microsoft C# .NET 5 13th Nov 2007 10:34 PM
Directory.CreateDirectory() issue Ken Microsoft Dot NET Framework 1 12th Nov 2007 08:21 PM
CreateDirectory() and Directory::CreateDirectory() conflict ... H.B. Microsoft VC .NET 1 6th Jun 2005 06:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:11 PM.