Powershell、ftp、get-childitem
对 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 站点上以这种方式访问文件名?
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您希望 Get-ChildItem 在通过 FTP 访问的远程文件系统上工作,您需要的是 FTP 的 PowerShell 提供程序。此论坛帖子提到了 Nick Howell 在 FTP 提供商方面所做的工作。除此之外,我还没有听说过任何其他适用于 PowerShell 的 FTP 提供商。
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.