4 Replies - 673 Views - Last Post: 26 August 2019 - 06:59 AM Rate Topic: -----

#1 Never Saint   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 25-August 19

How do I acces folders paths?

Posted 25 August 2019 - 11:38 AM

So far I only know to access the "main" folder paths in C# like Desktop.

Environment.CurrentDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);



But how do I access files that are in some "ordinary" folders? Like, let's say I want to access folder "C:\PerfLogs"?
Is This A Good Question/Topic? 0
  • +

Replies To: How do I acces folders paths?

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15315
  • View blog
  • Posts: 61,414
  • Joined: 12-June 08

Re: How do I acces folders paths?

Posted 25 August 2019 - 12:03 PM

For the most part paths just have \\ instead of one \. You shouldn't have an issue.
Was This Post Helpful? 0
  • +
  • -

#3 Never Saint   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 25-August 19

Re: How do I acces folders paths?

Posted 26 August 2019 - 12:20 AM

View Postmodi123_1, on 25 August 2019 - 12:03 PM, said:

For the most part paths just have \\ instead of one \. You shouldn't have an issue.


Yeah, but what would be the code line? Like I tried this one

Environment.CurrentDirectory = Environment.GetFolderPath(Environment.C:\\PerfLogs);



But it doesn't work.
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6819
  • View blog
  • Posts: 28,250
  • Joined: 12-December 12

Re: How do I acces folders paths?

Posted 26 August 2019 - 03:20 AM

That clearly won't work because c:etc is not a member of Environment. It is puzzling that you would attempt such code and indicates gaps in understanding.

C:etc would be quoted as a string, and provided to some method that expects a string. That is, a path as parameter.
Was This Post Helpful? 0
  • +
  • -

#5 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15315
  • View blog
  • Posts: 61,414
  • Joined: 12-June 08

Re: How do I acces folders paths?

Posted 26 August 2019 - 06:59 AM

You wouldn't set 'current directory'. You would just use the string "C:\\PerfLogs".
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1