We are currently in the process of exploring the sshj library to download a file from SFTP path into ADLS. We are using the example as reference.
We have already configured the ADLS Gen2 storage in Databricks to be accessed as an
abfssURL.We are using scala within Databricks.
How should we pass the
abfsspath asFileSystemFileobject in the get step ?sftp.get("test_file", new FileSystemFile("abfss://<container_name>@a<storage_account>.dfs.core.windows.net/<path>"));Is the destination supposed to be a file path only or file path with file name?
Use streams. First obtain
InputStreamof the source SFTP file:(How to read from the remote file into a Stream?)
Then obtain
OutputStreamof the destination file on ADLS:(How to upload and download a file from my locale to azure adls using java sdk?)
And copy from the first to the other:
(Easy way to write contents of a Java InputStream to an OutputStream)