PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/thread-self/root/proc/self/root/proc/self/root/proc/self/root/opt/tier2c/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/thread-self/root/proc/self/root/proc/self/root/proc/self/root/opt/tier2c/mv_backup.py

#!/opt/imh-python/bin/python3
"""Move cpanel backups to and from /home"""
from pathlib import Path
import argparse
import shlex
import sys

sys.path.insert(0, '/opt/support/lib')
from arg_types import cpmove_file_type, path_in_home


def parse_args() -> tuple[Path, Path]:
    """Validate and return source and destination paths"""
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument(
        'src',
        metavar='SOURCE',
        type=cpmove_file_type,
        help='cPanel backup file',
    )
    parser.add_argument(
        'dst',
        metavar='DESTINATION',
        type=path_in_home,
        help='destination folder',
    )
    args = parser.parse_args()
    return args.src, args.dst


def main():
    """Validate input, then move a cpanel backup in or out of /home"""
    source, dest_dir = parse_args()
    dest = dest_dir.joinpath(source.name)
    # perform the move
    try:
        print(shlex.quote(str(source)), '->', shlex.quote(str(dest)))
        source.rename(dest)
    except OSError as exc:
        sys.exit(exc)


if __name__ == '__main__':
    main()