You can download old version files using wget. In order to download old version files, Access token, File ID and Revision ID are required as the materials. The methods for retrieving the materials are follows. wget is used for all methods.
1. Access token
Reference : https://developers.google.com/identity/protocols/OAuth2
This is my old answer related to retrieving access token from Google OAuth2. Refresh Google drive access__token If this is useful for you, I'm glad.
2. File ID
In order to retrieve file ID, it searches it from file name using drive.files.list
.
wget -q --header='Authorization: Bearer ### Access token ###' \
'https://www.googleapis.com/drive/v3/files?q=name="### FileName ###"&fields=files(id,name)' \
-O out.txt
By this, you can find FileID
for the FileName in the out.txt
. If there are several files with same name, please select one of them.
Reference : https://developers.google.com/drive/v3/reference/files/list
3. Revision ID
In order to retrieve revision ID, it retrieves revision list for the FileID
using drive.revisions.list
.
wget -q --header='Authorization: Bearer ### Access token ###' \
'https://www.googleapis.com/drive/v3/files/### FileID ###/revisions?fields=revisions(id%2CmodifiedTime)' \
-O out.txt
By this, you can find RevisionID
for the FileID in the out.txt
. Please select revision ID you want.
Reference : https://developers.google.com/drive/v3/reference/revisions/list
4. File for Revision ID
Retrieves File for Revision ID using drive.revisions.get
.
wget -q --header='Authorization: Bearer ### Access token ###' \
"https://www.googleapis.com/drive/v3/files/### FileID ###/revisions/### RevisionID ###?alt=media" \
-O outputfilename
By this, a file with name of outputfilename
can be retrieved.
Reference : https://developers.google.com/drive/v3/reference/revisions/get