Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Linskun/0c513410460ddd17b3b5defa2e2fe682 to your computer and use it in GitHub Desktop.
Save Linskun/0c513410460ddd17b3b5defa2e2fe682 to your computer and use it in GitHub Desktop.
Download OneDrive files in terminal
Google Chrome as well as Mozilla Firerfox both provide an option to copy download link specifically for cURL. This option will generate cURL with all required things such as User agent for downloading things from the side. To get that,
1. Open the URL of the shared file in either of the above mentioned browsers.
2. Open Developer options using Ctrl+Shift+I (CMD+Option+I for Mac).
3. Go to Network tab.
4. Now click on download in the OneDrive view. Saving file isn't required. We only need the network activity while browser requests the file from the server.
5. A new entry will appear which would look like "download.aspx?...". You can also find it by filtering at the top left.
6. Right click on that and Copy → Copy as cURL.
7. Paste the copied content directly in the terminal and append `--output <file.extension>` to save the content in `file.extension` since terminal isn't capable of showing binary data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment