Skip to content

Instantly share code, notes, and snippets.

@mrahtz
Created Mar 9, 2019
Embed
What would you like to do?
#!/usr/bin/env python3
import argparse
import fileinput
import os
import socket
import sys
parser = argparse.ArgumentParser()
parser.add_argument('files', nargs='*')
args = parser.parse_args()
if args.files:
files = args.files
else:
files = []
for line in fileinput.input():
files.append(line.strip())
paths = []
for f in files:
if not os.path.exists(f):
print(f"Error: path '{f}' does not exist", file=sys.stderr)
exit(1)
paths.append(os.path.realpath(f))
print(f"rtransfer {socket.gethostname()} " + " ".join(paths))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment