You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/07/17 15:46:03 UTC

[GitHub] [airflow] potiuk commented on a change in pull request #16792: [AIRFLOW-5703] SFTP Provider list of files and directories

potiuk commented on a change in pull request #16792:
URL: https://github.com/apache/airflow/pull/16792#discussion_r671712201



##########
File path: airflow/providers/sftp/operators/sftp.py
##########
@@ -134,29 +176,68 @@ def execute(self, context: Any) -> str:
 
             with self.ssh_hook.get_conn() as ssh_client:
                 sftp_client = ssh_client.open_sftp()
-                if self.operation.lower() == SFTPOperation.GET:
-                    local_folder = os.path.dirname(self.local_filepath)
-                    if self.create_intermediate_dirs:
-                        Path(local_folder).mkdir(parents=True, exist_ok=True)
-                    file_msg = f"from {self.remote_filepath} to {self.local_filepath}"
-                    self.log.info("Starting to transfer %s", file_msg)
-                    sftp_client.get(self.remote_filepath, self.local_filepath)
+                if self.local_filepath and self.remote_filepath:
+                    if isinstance(self.local_filepath, list) and isinstance(self.remote_filepath, str):
+                        for file_path in self.local_filepath:
+                            local_folder = os.path.dirname(file_path)
+                            remote_folder = os.path.dirname(self.remote_filepath)
+                            local_file = ntpath.basename(file_path)

Review comment:
       You have mistake in your second comparision (missing "txt" in second example) - that's why you have difference 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org