Created
July 12, 2018 11:05
-
-
Save mayflower12/02c8f1cbeadc074bc52e480815b042ff to your computer and use it in GitHub Desktop.
Bulk download and rename file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mkdir RGD_PDF | |
counter=0 | |
for id in `cut -d "=" -f 2 google_file_links`; | |
do | |
echo $((counter++)); | |
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=${id}' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=${id}" -O RGD_PDF/RGD_$counter.pdf && rm -rf /tmp/cookies.txt | |
done; |
bash dl.sh
To generate pdf files with file name 1.pdf 2.pdf..., simply change the 'RGD_$counter.pdf' to '$counter.pdf'.
Then use pdftk to combine all the files in order with the following command:
pdftk *.pdf cat output newfile.pdf
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
create a file 'google_file_links' with all the links to download the file.