Skip to content

Commit bb49f30

Browse files
committed
Add ability to get files and directories using keyword.
1 parent 25d89ef commit bb49f30

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

SCPLibrary/library.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,22 @@ def put_directory(self, local_directory, remote_filepath):
102102
raise SCPNotConnectedError("An SCPLibrary connection must be created first using the 'Open Connection' keyword.")
103103
self.scp_client.put(local_directory, remote_filepath, recursive=True)
104104

105-
def get_file(self, remote_filepath, local_filepath):
105+
def get_file(self, remote_filepath, local_filepath, recursive=False):
106106
"""Downloads a file from the remote machine to the local machine.
107107
108+
`remote_filepath` determines the path to retrieve from remote host. Shell wildcards and environment variables
109+
on the remote machine may be used.
110+
111+
Setting `recursive` to True will transfer files and directories recursively.
112+
108113
Note: A connection to the remote machine must be made first using the `Open Connection` keyword.
109114
110115
Example:
111-
| Get File | /home/tyler/tea.txt | sametea.txt |
116+
| Get File | /home/tyler/tea.txt | sametea.txt | |
117+
| Get File | /home/tyler/*.txt | myteas/ | |
118+
| Get File | /home/tyler/ | mytylerdir/ | recursive=True |
112119
"""
113120
if self.scp_client is None:
114121
raise SCPNotConnectedError("An SCPLibrary connection must be created first using the 'Open Connection' keyword.")
115-
self.scp_client.get(remote_filepath, local_filepath)
122+
self.scp_client.get(remote_filepath, local_filepath, recursive=recursive)
123+
e

0 commit comments

Comments
 (0)