Skip to content

Commit e504f13

Browse files
authored
FEAT: Add Google Drive Downloader (#1284)
* Added a script to download files from Google Drive * Update README.md * Added Images showing the script in action * Removed downloaded files * Update README * Incorporated the changes requested * Used markdown for output images
1 parent 19a7b79 commit e504f13

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

BASH/GDrive Downloader/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Google Drive Downloader
2+
3+
* A simple BASH script to download files from Google Drive that allows resuming the downloads in case of failures.
4+
* Uses cURL to achieve the same.
5+
6+
## Note:
7+
8+
The script only works on google drive links that allow anyone on the internet with it to view the file and have the following format:
9+
10+
```
11+
https://drive.google.com/file/d/<fileID>/view?usp=sharing
12+
```
13+
14+
## Setup instructions
15+
16+
### Dependencies
17+
18+
- [cURL](https://curl.se/)
19+
20+
### Usage
21+
22+
Install the dependencies:
23+
```bash
24+
$ sudo apt install curl
25+
```
26+
27+
Get the file's link by right clicking on it and selecting the `Get link` option. Change the permissions as shown in the image below and copy the `fileID` portion of this link.
28+
<table>
29+
<tr>
30+
<td valign="top"><img src="https://imgur.com/uiVIR45.jpg"></td>
31+
<td valign="top"><img src="https://imgur.com/wpyKx8d.jpg"></td>
32+
</tr>
33+
</table>
34+
35+
Download the file by passing the `fileID` present in the file's link (as shown above) and a `fileName` of your choice as command line arguments to the script. `fileName` is important for resuming downloads in case they fail in the middle.
36+
37+
```bash
38+
$ chmod +x ./driveDownload.sh
39+
$ ./driveDownload.sh <fileID> <fileName>
40+
```
41+
42+
In case a download fails, just rerun the above command with the same arguments and the download will resume from where it had stopped!
43+
No progress lost!!
44+
45+
## Output
46+
47+
### Without any failures:
48+
49+
![No failures](https://imgur.com/NLIFvll.jpg)
50+
51+
### Manually stopping and resuming the download:
52+
53+
![Resuming Failed Download](https://imgur.com/BMu0nKu.jpg)
54+
55+
## Author
56+
57+
[Dhruval PB](https://github.com/Dhruval360)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
#https://drive.google.com/file/d/<fileId>/view?usp=sharing # <--- Link of the file on Gdrive to be downloaded
4+
if [ "$#" -lt 2 ]
5+
then
6+
echo "Usage: ./driveDownload.sh [fileID] [fileName]"
7+
exit 1
8+
fi
9+
10+
fileid=$1
11+
filename=$2
12+
curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${fileid}" > /dev/null
13+
curl -Lb ./cookie "https://drive.google.com/uc?export=download&confirm=$(awk "/download/ {print $NF}" ./cookie)&id=${fileid}" -C - --output ${filename}

0 commit comments

Comments
 (0)