Powershell, ftp, get-childitem

3

我是一名初学者,正在尝试使用PowerShell定位一个类似于get-childitem的命令,以便在FTP站点上使用。

以下是一些伪代码:

$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

get-childitem只能用于本地路径。请问有谁知道当在ftp站点时如何以此方式访问文件名?

谢谢


这里的答案可能会有所帮助:https://dev59.com/L3VC5IYBdhLWcg3wihmv - Sharjeel Aziz
1个回答

1
你需要的是一个PowerShell提供程序,如果你想让Get-ChildItem在通过FTP访问的远程文件系统上工作。这个论坛帖子提到了Nick Howell正在开发FTP提供程序。除此之外,我没有听说过其他任何适用于PowerShell的FTP提供程序。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接