Commit eb5f5176 authored by Gary Ruben's avatar Gary Ruben
Browse files

improved find command to avoid leading ./ on paths

parent 693b3525
......@@ -52,7 +52,7 @@ import time
from fabric import Connection
READ_PICKLE_FILE = False
READ_PICKLE_FILE = True
EXPERIMENT_NAME = "13660b"
PICKLE_FILENAME = os.path.join(os.path.dirname(__file__), "tree_state.pickle")
timestamp = time.strftime("%Y-%m-%d-%H%M%S")
......@@ -107,7 +107,7 @@ def tar_and_send_directory(node):
# add check to make sure connection is working
with Connection(REMOTE_LOGIN) as c:
files = c.run(
f'cd {node.src}; find -type f -maxdepth 1',
rf"cd {node.src}; find -maxdepth 1 -type f -printf '%f\n'",
echo=True
)
files = files.stdout.strip()
......@@ -115,7 +115,7 @@ def tar_and_send_directory(node):
# print(f'Connection failed on {node.src}')
# node.error = "Connection failure on initial file find"
# return
node.count = files.count('/')
node.count = files.count('\n')
print(f'Node:{node.src}, file count:{node.count}')
if node.count == 0:
......@@ -125,7 +125,7 @@ def tar_and_send_directory(node):
# Only one file. No need to tar. Just copy unchanged.
output = subprocess.run(
f"ssh {REMOTE_LOGIN} 'cd {node.src};"
f"find -type f -maxdepth 1 | cpio -o' |"
rf"find -maxdepth 1 -type f -printf '%f\n' | cpio -o' |"
f"cat > {node.dest}/{files}",
shell=True,
check=True
......@@ -143,8 +143,8 @@ def tar_and_send_directory(node):
output = subprocess.run(
f"ssh {REMOTE_LOGIN} 'cd {node.src};"
f"find -type f -maxdepth 1 -print0 | cpio -o -H ustar -0' |"
f"cat > {node.dest}/{filename}.tar",
rf"find -maxdepth 1 -type f -printf '%f\n' -print0 |"
f"cpio -o -H ustar -0' | cat > {node.dest}/{filename}.tar",
shell=True,
check=True
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment