Project

Transferetto

Small PowerShell module with FTPS/SFTP functionality

Stars64
Forks15
Open issues10
PowerShell Gallery downloads12712752
Releasev1.0.0
Language: PowerShell Updated: 2026-02-14T21:19:42.0000000+00:00

Curated Examples

Download files with SFTP

Use Transferetto to download selected files from a remote SFTP folder.

This pattern is useful when a process needs to collect exported files from a partner or internal SFTP endpoint.

It is adapted from the source example at Examples/Example12-Receive-SFTPFile.ps1.

When to use this pattern

  • You need to download each file from a remote folder.
  • The local landing folder is controlled by the script.
  • You want a status object for each transfer.

Example

Import-Module Transferetto

$credential = Get-Credential
$sftpClient = Connect-SFTP -Server 'sftp.example.com' -Credential $credential
$localFolder = Join-Path $PSScriptRoot 'Output\SftpDownload'

New-Item -ItemType Directory -Force -Path $localFolder | Out-Null

$remoteFiles = Get-SFTPList -SftpClient $sftpClient -Path '/pub/example' |
    Where-Object { -not $_.IsDirectory }

$output = foreach ($remoteFile in $remoteFiles) {
    $localPath = Join-Path $localFolder $remoteFile.Name
    Receive-SFTPFile -SftpClient $sftpClient -RemotePath $remoteFile.FullName -LocalPath $localPath
}

$output | Format-Table
Disconnect-SFTP -SftpClient $sftpClient

What this demonstrates

  • filtering remote folder entries to files
  • downloading into a deterministic local folder
  • returning transfer status objects for review

Source