From c65a2e3c33cb3bac3e727e997c1f5007ddd1d491 Mon Sep 17 00:00:00 2001 From: Yutaka Sawada <60930312+Yutaka-Sawada@users.noreply.github.com> Date: Mon, 20 Mar 2023 14:11:07 +0900 Subject: [PATCH] Add files via upload --- alpha/tool/batch/auto_c.cmd | 18 ++++++++++++ alpha/tool/batch/auto_c.py | 20 +++++++++++++ alpha/tool/batch/auto_v.cmd | 21 ++++++++++++++ alpha/tool/batch/auto_v.py | 24 ++++++++++++++++ alpha/tool/batch/auto_vl.py | 57 +++++++++++++++++++++++++++++++++++++ 5 files changed, 140 insertions(+) create mode 100644 alpha/tool/batch/auto_c.cmd create mode 100644 alpha/tool/batch/auto_c.py create mode 100644 alpha/tool/batch/auto_v.cmd create mode 100644 alpha/tool/batch/auto_v.py create mode 100644 alpha/tool/batch/auto_vl.py diff --git a/alpha/tool/batch/auto_c.cmd b/alpha/tool/batch/auto_c.cmd new file mode 100644 index 0000000..80953c7 --- /dev/null +++ b/alpha/tool/batch/auto_c.cmd @@ -0,0 +1,18 @@ +@ECHO OFF +TITLE After creation +SETLOCAL + +REM List up parameters +ECHO Path of this batch file = +ECHO %0 +ECHO. + +ECHO Path of a recovery file = +ECHO %1 +ECHO. + +ECHO Path of base directory of source files = +ECHO %2 +ECHO. + +pause diff --git a/alpha/tool/batch/auto_c.py b/alpha/tool/batch/auto_c.py new file mode 100644 index 0000000..ed86359 --- /dev/null +++ b/alpha/tool/batch/auto_c.py @@ -0,0 +1,20 @@ +import os +import sys + +os.system("TITLE After creation") + +# Read command-line arguments +if len(sys.argv) > 0: + this_path = sys.argv[0] + print("Path of this script file =\n" + this_path + "\n") + +if len(sys.argv) > 1: + recovery_path = sys.argv[1] + print("Path of a recovery file =\n" + recovery_path + "\n") + +if len(sys.argv) > 2: + base_path = sys.argv[2] + print("Path of base directory of source files =\n" + base_path + "\n") + +# If you don't confirm result, comment out below line. +input('Press [Enter] key to continue . . .') diff --git a/alpha/tool/batch/auto_v.cmd b/alpha/tool/batch/auto_v.cmd new file mode 100644 index 0000000..1685da9 --- /dev/null +++ b/alpha/tool/batch/auto_v.cmd @@ -0,0 +1,21 @@ +@ECHO OFF +TITLE After verification +SETLOCAL + +REM List up parameters +ECHO Path of this batch file = +ECHO %0 +ECHO. + +ECHO Path of a recovery file = +ECHO %1 +ECHO. + +ECHO Path of base directory of source files = +ECHO %2 +ECHO. + +ECHO Status of source files = %3 +ECHO. + +PAUSE diff --git a/alpha/tool/batch/auto_v.py b/alpha/tool/batch/auto_v.py new file mode 100644 index 0000000..20635a0 --- /dev/null +++ b/alpha/tool/batch/auto_v.py @@ -0,0 +1,24 @@ +import os +import sys + +os.system("TITLE After verification") + +# Read command-line arguments +if len(sys.argv) > 0: + this_path = sys.argv[0] + print("Path of this script file =\n" + this_path + "\n") + +if len(sys.argv) > 1: + recovery_path = sys.argv[1] + print("Path of a recovery file =\n" + recovery_path + "\n") + +if len(sys.argv) > 2: + base_path = sys.argv[2] + print("Path of base directory of source files =\n" + base_path + "\n") + +if len(sys.argv) > 3: + exit_code = sys.argv[3] + print("Status of source files = " + exit_code + "\n") + +# If you don't confirm result, comment out below line. +input('Press [Enter] key to continue . . .') diff --git a/alpha/tool/batch/auto_vl.py b/alpha/tool/batch/auto_vl.py new file mode 100644 index 0000000..dd30957 --- /dev/null +++ b/alpha/tool/batch/auto_vl.py @@ -0,0 +1,57 @@ +import os +import sys +import json + +os.system("TITLE After verification") + +# Read command-line arguments +if len(sys.argv) > 0: + this_path = sys.argv[0] + print("Path of this script file =\n" + this_path + "\n") + +if len(sys.argv) > 1: + recovery_path = sys.argv[1] + print("Path of a recovery file =\n" + recovery_path + "\n") + +if len(sys.argv) > 2: + base_path = sys.argv[2] + print("Path of base directory of source files =\n" + base_path + "\n") + +if len(sys.argv) > 3: + exit_code = sys.argv[3] + print("Status of source files = " + exit_code + "\n") + +# Construct path of JSON file +save_path = os.path.dirname(sys.argv[0]) +json_path = os.path.join(save_path, os.path.basename(recovery_path)) + ".json" +if os.path.isfile(json_path): + print("JSON file =\n" + json_path) + + # Open the JSON file and read the contents. + with open(json_path, 'r', encoding='utf-8') as f: + json_dict = json.load(f) + + # Get directory of recovery files. + file_path = json_dict["SelectedFile"] + recv_dir = os.path.dirname(file_path) + print("\nRecovery files' directory = " + recv_dir) + + # Get list of recovery files. + recv_list = json_dict["RecoveryFile"] + for file_name in recv_list: + print(file_name) + + # Get directory of source files. + src_dir = json_dict["BaseDirectory"] + print("\nSource files' directory = " + src_dir) + + # Get list of source files. + src_list = json_dict["SourceFile"] + for file_name in src_list: + print(file_name) + + # Erase JSON file (If you want to keep JSON file, comment out next line.) + os.remove(json_path) + +# If you don't confirm result, comment out below line. +input('Press [Enter] key to continue . . .')