Get-SFTPChildItem does not list file if exact filename specified
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.
as designs, the method for a session used is listdirectory(
Thanks for your reply. Maybe we could have -Name parameter back to be able to to get info about specific file, so we dont have to use:
Get-SFTPChildItem -SessionId $sess.SessionId -Path '/path/to/dir' | Where-Object -Property 'Name' -Like 'the-name-i-want'
P.S: If -Name no longer works, but it's visible in Man Get-SFTPChilditem, I think this flag should be removed from manual or else it's confusing. Or, even better, make it work.