473,748 Members | 2,380 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 2570
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
15889
by: MAF | last post by:
How do I create a directory inside C#?
1
2422
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
1534
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
2201
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
2430
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
3953
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
8692
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
2824
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
8995
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
9378
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...
0
9253
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6077
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
4608
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...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3316
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
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2216
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.