Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: wildcard pattern matching #589

Closed
Agent-E11 opened this issue Aug 30, 2024 · 3 comments
Closed

feat: wildcard pattern matching #589

Agent-E11 opened this issue Aug 30, 2024 · 3 comments

Comments

@Agent-E11
Copy link

It would be very nice to be able to supply a wildcard pattern to Get-SFTPChildItem. Currently, if you were to run

Get-SFTPChildItem -SessionId 0 -Path /pattern*

You would get the error:

Path /pattern* doesn't exist on the target host.

This wildcard matching is possible in the default sftp program that comes with Redhat:

sftp user@host:/pattern*

and in the PowerShell cmdlet Get-ChildItem:

Get-ChildItem -Path C:\pattern*

Based on the discrepancy between the functionality of Get-ChildItem and Get-SFTPChildItem, this may be considered a bug.

@darkoperator
Copy link
Owner

calling it a bug would be stretching it :) whould be easy to do say for file or directory names in a given path, for the path it self to enumerate will have to look at it since the library does not support use of wildcard and would need to write a wrapper to go one level down from the wildcard enumerate directories only and match does and then for those that match then enumerate their content

@darkoperator
Copy link
Owner

was not as difficult as I thought

image

Added also a parameter name where wildcards can also be used in the next release

image

darkoperator added a commit that referenced this issue Aug 31, 2024
* Added support for wilcards in the path of Get-SFTPChildItem
* Added a new parameter called name to filter on the names of directory and files using wildcards

This addresses feature request #589 for the next release
@darkoperator
Copy link
Owner

in latest release 3.2.2

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants