diff options
| author | Adam Olech <nddr89@gmail.com> | 2021-06-23 19:08:34 +0200 |
|---|---|---|
| committer | Adam Olech <nddr89@gmail.com> | 2021-06-23 19:08:34 +0200 |
| commit | fdebe619477570d28d522345956ef10d2acfd7cf (patch) | |
| tree | 5221838c7a919d1029664f2425fbdff1bc2c91ae /tar_over_paramiko.py | |
| parent | 079946ef90234ab03168e2cf8fdddddc0467a996 (diff) | |
More work on tar_over_paramiko
Diffstat (limited to 'tar_over_paramiko.py')
| -rwxr-xr-x | tar_over_paramiko.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tar_over_paramiko.py b/tar_over_paramiko.py index e56219f..42ed69f 100755 --- a/tar_over_paramiko.py +++ b/tar_over_paramiko.py @@ -20,7 +20,22 @@ ssh.connect( pkey=key, ) -stdin, stdout, stderr = ssh.exec_command('tar cf - {}'.format(sys.argv[4])) +tarlist = 'tarlist.txt' +find_cmd = 'find {} -type f > {}'.format(sys.argv[4], tarlist) + +stdin, stdout, stderr = ssh.exec_command('sh') +stdin.write(find_cmd) + +stdin.flush() +stdin.channel.shutdown_write() + +for l in stdout: + print('[FIND STDOUT]\t{}'.format(l.strip('\n'))) + +for l in stderr: + print('[FIND STDOUT]\t{}'.format(l.strip('\n'))) + +stdin, stdout, stderr = ssh.exec_command('tar cf - -T {}'.format(tarlist)) stderr_lines = 0 stdout_lines = 0 stdout_type = None @@ -53,4 +68,5 @@ print(f"Type of stdout line is {stdout_type}") for tarinfo in tar_obj: print(tarinfo) +tar_obj.close() ssh.close() |
