diff --git a/smbclientng/core/InteractiveShell.py b/smbclientng/core/InteractiveShell.py index 92efe18..cbb4985 100644 --- a/smbclientng/core/InteractiveShell.py +++ b/smbclientng/core/InteractiveShell.py @@ -441,7 +441,7 @@ def command_ls(self, arguments, command): directory_contents = self.smbSession.list_contents(path=' '.join(arguments)) for longname in sorted(directory_contents.keys(), key=lambda x:x.lower()): - windows_ls_entry(directory_contents[longname]) + windows_ls_entry(directory_contents[longname], self.config) @command_arguments_required @active_smb_connection_needed diff --git a/smbclientng/core/utils.py b/smbclientng/core/utils.py index 8b46f9c..1a93a0c 100644 --- a/smbclientng/core/utils.py +++ b/smbclientng/core/utils.py @@ -148,8 +148,10 @@ def windows_ls_entry(entry, config, pathToPrint=None): str: A string representing the metadata of the entry, including attributes like directory, archive, compressed, hidden, normal, readonly, system, and temporary. """ - if pathToPrint is None: - pathToPrint = entry + if pathToPrint is not None: + pathToPrint = pathToPrint + ntpath.sep + entry.get_longname() + else: + pathToPrint = entry.get_longname() meta_string = "" meta_string += ("d" if entry.is_directory() else "-")