Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get chrome downloads folder

The default downloads folder in Windows 7 is c:\users\username\downloads for Chrome. But default downloads folder can be set to another folder through settings. I need to find out which folder is the downloads folder. So if I set the downloads folder to c:\dd, then I need to find out the specific folder.

Is there a way of finding this out using C#? I mean I don't want to visit the chrome settings and fetch the folder path from there.

like image 549
weiszam Avatar asked Jul 10 '12 11:07

weiszam


1 Answers

The default locations for Chrome settings are here. I actually found mine to be under 'C:\Users[UserName]\AppData\Local\Google\Chrome\User Data\Default' for Chrome 20.0.1132.47.

If you open the Preferences file, you can parse the JSON to get the download folder:

"download": {
  "default_directory": "C:\\Users\\[UserName]\\Downloads",
  "directory_upgrade": true,
  "extensions_to_open": ""
}

If there is no default_directory value, then the directory C:\Users\[UserName]\Downloads is being used.

like image 129
ScottieMc Avatar answered Sep 20 '22 18:09

ScottieMc