darkoperator / darkoperator/Posh-SSH

Get-SFTPChildItem does not list file if exact filename specified

Open
#598 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1.1k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

In v3.2.4, Get-SFTPChildItem no longer has -Name parameter and seems like we are supposed to specify file name in -Parh parameter.
However, if you run, for example:

Get-SFTPChildItem -SessionId $sess.SessionId -Path '/home/vlad/.xteve/backup/xteve_auto_backup_20241012_0405.zip'

It will respond with:

Write-Error: Error listing items in /home/vlad/.xteve/backup/xteve_auto_backup_20241012_0405.zip: Exception calling "ListDirectory"
with "1" argument(s): "No such file"

Such file definitely exist and in v3.2.3, if you pass file name with -Name parameter, it returns info about that file.

Note: If you add asterisk in the end of the file name like that:

Get-SFTPChildItem -SessionId $sess.SessionId -Path '/home/vlad/.xteve/backup/xteve_auto_backup_20241012_0405.zip*'

everything will work, but it's inconvenient.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the exact-file-path case with Get-SFTPChildItem, then compare it with the wildcard form and the v3.2.3 -Name behavior described in the issue. Trace how Get-SFTPChildItem handles an exact remote path versus a pattern; done means an existing file is returned when its exact filename is supplied without requiring a trailing asterisk.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.