딥러닝 모델을 벤치마킹하다보면, 굉장히 대용량의 데이터셋을 다운로드할일이 많아진다. 그 중에서도 google drive에 올려져있는 경우에 (나같은 경우) chrome에서 이를 다운로드 받으면 렉이 엄청 걸리고, 시간도 정말 오래걸린다.
그래서 찾아보니 wget으로 google drive의 파일을 다운받을 수 있는 방법이 있다. 방법은 아래와 같다.
※ 주의 : 100MB이상인 파일에서 실행
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=FILEID" -O FILENAME && rm -rf /tmp/cookies.txt
코드에서 FILEID라고 되어있는 부분과 FILENAME이라고 되어있는 부분만 실제 파일에 관한 정보로 바꾸어주면 된다.
FILENAME은 말그대로 파일명을 (확장자까지) 넣어주면 되고, FILEID같은 경우에는 다운로드 링크url이 만약에 https://drive.google.com/file/d/1gSiDiJAIkBJnkXFYEGmyMnSISwiQprfD/view?usp=drive_link 라면, 1gSiDiJAIkBJnkXFYEGmyMnSISwiQprfD가 id이다.
chrome으로 다운로드를 받을때보다 훨씬 쾌적한 환경으로 cli 에서 파일을 다운로드 받을 수 있다.
그 이외의 자세한 사항은 해당 사이트에 자세히 나와있다. (참조 사이트)
Download Google Drive Files Using WGET: A Step-by-Step Guide
Downloading Google Drive files using WGET is an efficient method for retrieving files from your cloud storage. In this blog post, we will explore how to use WGET for an effortless downloading experience from Google Drive. We'll begin by exploring the benef
chemicloud.com
'Programming > basic' 카테고리의 다른 글
프로그래밍의 종류에 대해서 알아보자!! (명령형, 절차 지향, 함수형, 선언형, 논리형, 객체 지향 언어) (0) | 2023.06.21 |
---|