fetch latest files from Sftp server by powershell

0

1

I have a situation where I need to find latest flies on directories on SFTP servers and if files are persisted in the directories then email triggered. I am trying to get this by Powershell with POSH-SSH module. but i am not getting this.

it will very helpful for me to give some info or help on this.

this should be in Powershell only and with SFTP no FTP.

Rajesh

Posted 2019-09-21T09:44:02.153

Reputation: 1

What is your PowerShell Command-Line? – None – 2019-09-21T10:23:06.707

1Basically I am trying to imp this. as of now, I am trying to fetch files name but it gives me directory name as well. $getfiles =@(Get-SFTPChildItem $sessionTest -Path $sourceTest | select FullName). is any way to get files to name without directory name – Rajesh – 2019-09-21T10:56:15.597

I see a Note, @Rajesh, that states that "The –Directory, -File, -Attributes, -Hidden, and –System switches were added to Get-ChildItem cmdlet in Windows PowerShell 3.0". Maybe you can negate the -Directory Switch somehow. – None – 2019-09-21T13:58:58.783

In the situation when the Get-SFTPChildItem Command-Let has absolutely nothing to do with the Get-ChildItem Command-Let and its Output provides only the FullName Line, then I guess that you verily have nothing else to do than to parse the Unqualified File Name by yourself. – None – 2019-09-21T14:18:32.800

See also Downloading yesterday files in PowerShell using WinSCP.

– Martin Prikryl – 2019-09-21T15:06:06.543

No answers