ProdigioM
ProdigioM

Reputation: 474

Directory.GetFiles() with C: and C:\

I'm simply using Directory.GetFiles() to get all files in that directory.

What I found out is, that C: as a parameter is giving back all files which are in my release folder (at least it seems so).

C:\ gives me the real C:\folder like I assumed.

Why is this happening?

Upvotes: 3

Views: 1004

Answers (1)

king_nak
king_nak

Reputation: 11513

C: refers to the current directory on the C drive, which happens to be your release folder. C:\ refers to the root directory on the C drive.

You can also use paths like C:..\test.txt which is a relative path to the current directory on C, or \test.txt which is an absolute path on the current drive

See this MSDN article about naming files and paths for details

Upvotes: 11

Related Questions