Skip to content

Instantly share code, notes, and snippets.

@Aebian
Last active September 6, 2020 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Aebian/d5cc93d054b703102bfa16cd90951406 to your computer and use it in GitHub Desktop.
Save Aebian/d5cc93d054b703102bfa16cd90951406 to your computer and use it in GitHub Desktop.
import argparse
import shutil
import os
import sys
def create_arg_parser():
parser = argparse.ArgumentParser(description='Copies a file a given time and renames it')
parser.add_argument('-s', dest="source_file",
help='The source file that should be copied')
parser.add_argument('-l', dest="outfile_names", nargs='+', type=str, help='Pass a list of names that will be used for renaming. Need to match with')
return parser
if __name__ == "__main__":
arg_parser = create_arg_parser()
args = arg_parser.parse_args()
source_file = args.source_file
outfile_names = args.outfile_names
for filename in outfile_names:
shutil.copyfile(source_file, os.path.dirname(source_file) + "/" + filename)
# © 2008 - 2018 by Aebian
python3.5 copy_and_rename_file.py -s "/mnt/e/Games/Mods/GTAMODS_Drive/@DLC/natioh/dlc.rpf/x64/data/lang/americandlc.rpf" -l chinesedlc.rpf frenchdlc.rpf germandlc.rpf italiandlc.rpf japanesedlc.rpf koreandlc.rpf mexicandlc.rpf polishdlc.rpf portuguesedlc.rpf russiandlc.rpf spanishdlc.rpf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment