File size: 369 Bytes
8cb5b3c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gdown
import os


def download_gdrive(id, dir = ".", filename = None):
    print('download...')
    tmp_filename = gdown.download(id=id, quiet=True)
    if filename is None:
        filename = tmp_filename

    file_path = f'{dir}/{filename}'

    if os.path.isdir(dir) == False: os.mkdir(dir)        
    os.replace(tmp_filename, file_path)
    return file_path