Posh-SSH icon indicating copy to clipboard operation
Posh-SSH copied to clipboard

Get-SFTPChildItem

Open jason27300 opened this issue 4 years ago • 3 comments

When I run 'Get-SFTPChildItem -SFTPSession $Session -Path $Path' it also captures the entire directory folder and parent folder. I end up with the entire parent folder, then the folder I'm in, then all the files I was actually looking for.

I use this command to pipe the items I need to download to the 'Get-SFTPItem' command

Any idea what's going on here , I did try -recursive but I would prefer to preserve the folder structure if a bunch of files are added.

jason27300 avatar Jan 19 '22 15:01 jason27300

Trying to replicate with Posh-SSH 3.0 against an Ubuntu server and hacve not been able to replicate this.   Can you provide more information on your setup? Sent from Mail for Windows From: jason27300Sent: Wednesday, January 19, 2022 11:49 AMTo: darkoperator/Posh-SSHCc: SubscribedSubject: [darkoperator/Posh-SSH] Get-SFTPChildItem (Issue #441) When I run 'Get-SFTPChildItem -SFTPSession $Session -Path $Path' it also captures the entire directory folder and parent folder. I end up with the entire parent folder, then the folder I'm in, then all the files I was actually looking for.I use this command to pipe the items I need to download to the 'Get-SFTPItem' commandAny idea what's going on here , I did try -recursive but I would prefer to preserve the folder structure if a bunch of files are added.—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.Message ID: ***@***.***> 

darkoperator avatar Jan 19 '22 17:01 darkoperator

Trying to replicate with Posh-SSH 3.0 against an Ubuntu server and hacve not been able to replicate this.   Can you provide more information on your setup? Sent from Mail for Windows From: jason27300Sent: Wednesday, January 19, 2022 11:49 AMTo: darkoperator/Posh-SSHCc: SubscribedSubject: [darkoperator/Posh-SSH] Get-SFTPChildItem (Issue #441) When I run 'Get-SFTPChildItem -SFTPSession $Session -Path $Path' it also captures the entire directory folder and parent folder. I end up with the entire parent folder, then the folder I'm in, then all the files I was actually looking for.I use this command to pipe the items I need to download to the 'Get-SFTPItem' commandAny idea what's going on here , I did try -recursive but I would prefer to preserve the folder structure if a bunch of files are added.—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.Message ID: ***@***.***> 

Hi, it's on Windows server 2016 and connecting to Unix I think. It seems to use the name '..' and '.' To pull these folders in. I've used a not equal to argument to stop it from downloading these. Thanks

jason27300 avatar Jan 19 '22 18:01 jason27300

Get-SFTPChildItem -SessionId 0 | where {-not $_.name.endswith("..")} | select name Or  Get-SFTPChildItem -SessionId 0 | where {$_.isregularfile} for only files. You can pipe the object to get-member or to format-list -property * to see all properties and their values.   Sent from Mail for Windows From: jason27300Sent: Wednesday, January 19, 2022 2:03 PMTo: darkoperator/Posh-SSHCc: Carlos Perez; CommentSubject: Re: [darkoperator/Posh-SSH] Get-SFTPChildItem (Issue #441) Trying to replicate with Posh-SSH 3.0 against an Ubuntu server and hacve not been able to replicate this.   Can you provide more information on your setup? Sent from Mail for Windows From: jason27300Sent: Wednesday, January 19, 2022 11:49 AMTo: darkoperator/Posh-SSHCc: SubscribedSubject: [darkoperator/Posh-SSH] Get-SFTPChildItem (Issue #441) When I run 'Get-SFTPChildItem -SFTPSession $Session -Path $Path' it also captures the entire directory folder and parent folder. I end up with the entire parent folder, then the folder I'm in, then all the files I was actually looking for.I use this command to pipe the items I need to download to the 'Get-SFTPItem' commandAny idea what's going on here , I did try -recursive but I would prefer to preserve the folder structure if a bunch of files are added.—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>  Hi, it's on Windows server 2016 and connecting to Unix I think. It seems to use the name '..' and '.' To pull these folders in. I've used a not equal to argument to stop it from downloading these. Thanks—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: ***@***.***> 

darkoperator avatar Jan 19 '22 18:01 darkoperator