0

I am trying to find the full path of a folder from just the name of the folder. The folder in question is advdupe2 folder that is usually situated in \SteamLibrary\steamapps\common\GarrysMod\garrysmod\data\advdupe2 but people might have the SteamLibrary folder in different locations for example i have it on D:\steam\SteamLibrary\steamapps\common\GarrysMod\garrysmod\data\advdupe2 and it is by default on C:\Program Files\Steam\steamapps\. I have tried searching for this everywhere but i can find no references to this.

I looking for something like string folderPath = findFolder(folderName);

Ee0Rk
  • 33
  • 6
  • Have you made any attempts at it? – Andrew Corrigan Dec 16 '21 at 13:57
  • Welcome to stackoverflow! Can you please clarify if it's only that exact example where you need to find the steam game installation path or if you need to find a "random" folder on your computer? If it's only steam games, there may be better ways. – Chrᴉz remembers Monica Dec 16 '21 at 13:57
  • 2
    Does this answer your question? [Find steam games folder](https://stackoverflow.com/questions/34090258/find-steam-games-folder) – Chrᴉz remembers Monica Dec 16 '21 at 13:58
  • What if you have more than one folders with the same name? For advdupe2 there might not be, but for a general solution this is a possibility. – mcy Dec 16 '21 at 14:00
  • It seems that, on the face of it, you're specifically looking for a known location within the steam folder, hence the suggested duplicate is relevant. If you're looking for a general solution, let me know and I'll retract the close vote. To find a subfolder within a main folder, you can use [Directory.EnumerateDirectories](https://learn.microsoft.com/en-us/dotnet/api/system.io.directory.enumeratedirectories?view=net-6.0) specifying the pattern describing the name of the folder you're looking for – Caius Jard Dec 16 '21 at 14:04
  • @ChrᴉzremembersMonica Im not sure that can be duplicated for linux though :/ – Ee0Rk Dec 16 '21 at 14:05
  • @mcy If i add for example \common\GarrysMod\garrysmod\data\advdupe2 to searching it might work better – Ee0Rk Dec 16 '21 at 14:07
  • @Ee0Rk Please add that information to your question. You only tagged it as C#, no editor, no OS, no .Net Core or sth. – Chrᴉz remembers Monica Dec 16 '21 at 14:08
  • @AndrewCorrigan No im not good enough at c# for that, i tried my best at making some tries but no it didnt go well – Ee0Rk Dec 16 '21 at 14:18

0 Answers0