[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

System.IO.DirectoryInfo.Exists question

Yavor Boichev

12/18/2002 1:16:00 PM

If a directory "c:\temp" exists then:

new System.IO.DirectoryInfo(@"c:\temp").Exists = true

but

new System.IO.DirectoryInfo(@"c:\temp\").Exists = false


Shouldn't the second result be true? After all "c:\temp\"
is another alias of the same existing directory.
4 Answers

NETMaster

12/18/2002 1:50:00 PM

0

> new System.IO.DirectoryInfo(@"c:\temp\").Exists = false

This works for me... (= true)

I tested with .NET 1.0 SP2 and 1.1 FB, on Windows XPSP1 with NTFS.
Do you use any other (.NET beta) ?


Also try 'verbose' code:

DirectoryInfo di = new DirectoryInfo( @"c:\temp\" );
bool exists = di.Exists;


or alternative:

bool ss = Directory.Exists( @"c:\temp\" );



--
Thomas Scheidegger - MVP .NET - 'NETMaster'
http://www.cetus-links.org/oo_d... - http://dnetm...


Yavor Boichev

12/18/2002 2:07:00 PM

0

I use .NET 1.1 and none of the verbose codes you've provided works
OS is win2000 sp3
"Thomas Scheidegger [MVP] NETMaster" <spam.netmaster@swissonline.ch> wrote
in message news:eOJNLOppCHA.2284@tk2msftngp13...
> > new System.IO.DirectoryInfo(@"c:\temp\").Exists = false
>
> This works for me... (= true)
>
> I tested with .NET 1.0 SP2 and 1.1 FB, on Windows XPSP1 with NTFS.
> Do you use any other (.NET beta) ?
>
>
> Also try 'verbose' code:
>
> DirectoryInfo di = new DirectoryInfo( @"c:\temp\" );
> bool exists = di.Exists;
>
>
> or alternative:
>
> bool ss = Directory.Exists( @"c:\temp\" );
>
>
>
> --
> Thomas Scheidegger - MVP .NET - 'NETMaster'
> http://www.cetus-links.org/oo_d... - http://dnetm...
>
>


NETMaster

12/18/2002 3:22:00 PM

0

I tested again on Windows 2000 SP3 with .NET 1.1 FB:
it works for me...


> I use .NET 1.1

- which 1.1 version? ('Final Beta'?)
Check file version of ...win-dir..\Microsoft.NET\Framework\v1.1.4322\ mscorcfg.dll
1.1.4322.510 = FB.

- does this only happen with c:\temp\,
or also with all other directories (e.g. c:\winnt\) ?


- is your C: drive formated with NTFS ?
- if yes, what are the security settings?

- is this c:\temp\ dir empty?

- for a final test, but maybe you no longer can reproduce the problem :
first create a backup of c:\temp\
- delete all content, test again.
- delete c:\temp\, then recreate it, test again



--
Thomas Scheidegger - MVP .NET - 'NETMaster'
http://www.cetus-links.org/oo_d... - http://dnetm...



(Mike Clay (MSFT))

12/20/2002 9:54:00 PM

0

Hi Yavor,

I tested and got "True" in both scenarios also. I'm still trying to figure
out what might cause that property to return False.

Mike Clay, MCSD
Beta Technical Support


This posting is provided "AS IS" with no warranties, and confers no rights.
© 2002 Microsoft Corporation. All rights reserved.