40 lines
878 B
Python
Executable File
40 lines
878 B
Python
Executable File
#!/usr/bin/env python3
|
|
# Копирование файлов из/на сервер
|
|
# scp_helper [host1:]/path [host2:]/path
|
|
|
|
import argparse
|
|
import os
|
|
|
|
from helperlib import *
|
|
|
|
if __name__ == '__main__':
|
|
parser = argparse.ArgumentParser(
|
|
description='Copy files'
|
|
)
|
|
parser.add_argument('in_path', type=str)
|
|
parser.add_argument('out_path', type=str)
|
|
|
|
args = parser.parse_args()
|
|
|
|
in_config = get_path_config(args.in_path)
|
|
out_config = get_path_config(args.out_path)
|
|
|
|
in_cmd = make_full_cmd(
|
|
in_config,
|
|
make_pack_cmd
|
|
)
|
|
|
|
out_cmd = make_full_cmd(
|
|
out_config,
|
|
make_unpack_cmd
|
|
)
|
|
|
|
full_cmd = f'{in_cmd} | {out_cmd}'
|
|
print("Будет выполнена команда:")
|
|
print(full_cmd)
|
|
print("продолжить (y/n)")
|
|
if input() in ('y','Y'):
|
|
os.system(full_cmd)
|
|
|
|
|