Skip to content

Commit

Permalink
Merge pull request #29 from p0dalirius/fix-get-command
Browse files Browse the repository at this point in the history
[enhancement] Implement wildcards in 'get' command
  • Loading branch information
p0dalirius authored Jun 13, 2024
2 parents b8ffbe8 + b06b1d9 commit 39161f7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion smbclientng/core/SMBSession.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,12 @@ def get_file_recursively(self, path=None):
"""

def recurse_action(base_dir="", path=[]):
remote_smb_path = base_dir + ntpath.sep.join(path)
if len(base_dir) == 0:
remote_smb_path = ntpath.sep.join(path)
else:
remote_smb_path = base_dir + ntpath.sep + ntpath.sep.join(path)
remote_smb_path = ntpath.normpath(remote_smb_path)

entries = self.smbClient.listPath(
shareName=self.smb_share,
path=remote_smb_path + '\\*'
Expand All @@ -321,6 +326,7 @@ def recurse_action(base_dir="", path=[]):
mode="wb",
path=remote_smb_path + ntpath.sep + entry_file.get_longname(),
expected_size=entry_file.get_filesize(),
keepRemotePath=True,
debug=self.config.debug
)
try:
Expand Down

0 comments on commit 39161f7

Please sign in to comment.