![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jan 2005
Posts: 29
Rep Power: 0
![]() |
Finding directories
I was wondering if I can use wildcards in a path. I'm trying to find out if a certain directory exists in C:\Program Files..
I know I can use if (!Directory.Exists(C:\Program Files\Test Prog) But can is there a way to find the directory without being exact? Like if (Directory.Exists(C:\Program Files\Tes*) to see if any folder with test exists? Thanks.. hope i was clear enough ![]() |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Jan 2005
Posts: 29
Rep Power: 0
![]() |
Hmm, Never mind, I found a better solution, but I have a question about File.Delete...
Can I Use something like this: File.Delete(@"C:\Program Files\test.exe"); Or do i not need the @? |
|
|
|
|
|
#3 |
|
Expert Programmer
|
Hmm, I'm not sure, but I do know a way you can find out, just make test.txt, and try deleting it.
|
|
|
|
|
|
#4 |
|
Newbie
|
Yes, you can use File.Delete. You can read more about it at MSDN: File.Delete Method (.NET Framework).
The @ as a prefix for a string is often used with path-strings. Instead of using the esapce sequence for a backslash ('\\'), you can use @ to disable '\' as a escape char, so instead of specifying the string "C:\\Programs\\ChromeCode\\LineCounter\\Data\\" you can write @"C:\Programs\ChromeCode\LineCounter\Data\". This increases the readability. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|