Last active
December 7, 2020 15:21
-
-
Save Tweetus-Bot/ca955a05ae062d253556c49eb3c095c2 to your computer and use it in GitHub Desktop.
Noob script to copy files from many gdrive links from a text file
This file contains hidden or 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
# credits: regex101.com, t.me/wfjpwf for the replace thing. (line no. 11) | |
# fsymbols.com/generators/carty this is where I got the ascii art. | |
# Inspiration: https://github.com/BlackPearl-Forum/Blackpearl-Link-Creator/blob/361ca418ca253be895c6db26d7f3ab5549b59954/links.py (such a neat code!) | |
import re, sys, os | |
def file_id(file): | |
regex = r"[\w-]{33}" | |
matches = re.finditer(regex, links, re.MULTILINE) | |
for matchNum, match in enumerate(matches, start=1): | |
match = match.group() | |
gclone_cmd = "gclone copy {}{} {} --drive-server-side-across-configs --drive-shared-with-me -P --drive-acknowledge-abuse --ignore-existing --stats-one-line".format(src, {match}, dest) | |
gclone = gclone_cmd.replace("\'","",2) # thanks to t.me/wfjpwf | |
os.system(gclone) | |
print("Successfully Copied!\n") | |
print(""" | |
██████╗ ██╗ ██╗██╗ ██╗ ██╗ █████╗ █████╗ ██████╗ ██╗ ██╗ | |
██╔══██╗██║ ██║██║ ██║ ██╔╝██╔══██╗██╔══██╗██╔══██╗╚██╗ ██╔╝ | |
██████╦╝██║ ██║██║ █████═╝ ██║ ╚═╝██║ ██║██████╔╝ ╚████╔╝ | |
██╔══██╗██║ ██║██║ ██╔═██╗ ██║ ██╗██║ ██║██╔═══╝ ╚██╔╝ | |
██████╦╝╚██████╔╝███████╗██║ ╚██╗╚█████╔╝╚█████╔╝██║ ██║ | |
╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚════╝ ╚════╝ ╚═╝ ╚═╝ """) | |
src = input("\nEnter source remote only. Example: remote: \nSource Remote: ") | |
dest = input("\nEnter destination remote with path. Example: remote:{folderIdHere} It's better to enter folder ID instead of giving full path. \nDestination Remote: ") | |
print('\n') | |
file = open(sys.argv[1], "r") | |
links = file.read() | |
file_id(links) | |
file.close() | |
sys.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
python bulkcopy.py links.txt
links.txt is where you save your links
examples:
src = remote:
dest = remote:{folder_id}
Requirements:
gclone
rclone.conf
Service Accounts(optional)