Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell, ftp, get-childitem

Little new to powershell. I am trying to locate a get-childitem like command that will work on an ftp site.

Here is some psuedo-code:

$target = "c:\file.txt"
$username = "username"
$password = "password"
$ftp = "ftp://$username:$password@myftpsite"

$webclient = New-Object System.Net.WebClient 
$uri = New-Object System.Uri($ftp) 

#below is the code that does not work, get-childitem needs a local path
$name = get-childitem -path $ftp

The get-childitem only works with a local path. Does anyone know how I could access the filenames in this manner when on an ftp site?

Thanks

like image 789
James Avatar asked Jan 27 '26 15:01

James


1 Answers

What you would need is a PowerShell provider for FTP if you wanted Get-ChildItem to work on a remote filesystem accessed by FTP. This forum post mentions work being done by Nick Howell on an FTP provider. Other than that, I haven't heard of any other FTP providers for PowerShell.

like image 51
Keith Hill Avatar answered Jan 29 '26 07:01

Keith Hill



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!