Skip to content
Snippets Groups Projects
Commit d36a9b3f authored by Gary Ruben's avatar Gary Ruben
Browse files

Changed single file send to use scp

parent 039f85c8
No related branches found
No related tags found
No related merge requests found
......@@ -89,7 +89,7 @@ class Logger(object):
self.log.flush()
def tar_and_send_directory(node):
def send_directory(node):
"""Sends all files in the node.src directory to the node.dest directory
across an ssh connection using the cpio command to tar the files into a
single tarball. The destination tarball is named after the directories
......@@ -119,11 +119,9 @@ def tar_and_send_directory(node):
# No files at this node, just return
print('No files to transfer')
elif node.count == 1:
# Only one file. No need to tar. Just copy unchanged.
# Only one file. Just copy unchanged.
output = subprocess.run(
f"ssh {REMOTE_LOGIN} 'cd {node.src};"
f"find -maxdepth 1 -type f | cpio -o' |"
f"cat > {node.dest}/{files}",
f"scp -q {REMOTE_LOGIN}:{node.src}/{files} {node.dest}",
shell=True,
check=True
)
......@@ -192,7 +190,7 @@ if __name__ == "__main__":
if not node.processed:
pathlib.Path(node.dest).mkdir(parents=True, exist_ok=True)
os.chmod(node.dest, 0o770)
tar_and_send_directory(node)
send_directory(node)
# pickle the tree to keep a record of the processed state
with open(PICKLE_FILENAME, 'wb') as f:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment