开发者

Powershell, ftp, get-childitem

开发者 https://www.devze.com 2022-12-31 17:36 出处:网络
Little new to powershell.I am trying to locate a get-childitem like command that will work on an ftp site.

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:$passwo开发者_运维知识库rd@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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消