powershell - 我没有看到任何文件
问题描述
伤脑筋,但我不明白出了什么问题。我有代码:
Import-Module PSFTP
$FTPServer = 'some ftp'
$FTPUsername = 'login'
$FTPPassword = 'password'
$locpath = "D:\test"
$date = Get-Date
$FTPSecurePassword = ConvertTo-SecureString -String $FTPPassword -asPlainText -Force
$FTPCredential = New-Object System.Management.Automation.PSCredential($FTPUsername,$FTPSecurePassword)
Set-FTPConnection -Credentials $FTPCredential -Server $FTPServer -ignoreCert -Session MySession -UseBinary -UsePassive
$Session = Get-FTPConnection -Session MySession
$ftp= Get-FTPChildItem -Session $Session -Recurse
$loc= gci $locpath -Recurse
Compare-Object ($ftp) ($loc) -Property Name | Where-Object {$_.SideIndicator -eq "<="} | ForEach-Object {
$lastfile=$_.Name
Get-FTPItem -Session $Session $lastfile -LocalPath $locpath
}
当您调用变量$ftp
时,我看到以下内容
PS C:\Users\test> $ftp
Parent: ftp://some ftp
Dir Right Ln User Group Size ModifiedDate Name
--- ----- -- ---- ----- ---- ------------ ----
- B
- B
为什么我看不到文件和文件的大小(顺便说一下,此脚本不会复制文件)
解决方案
推荐阅读
- php - PHP:从多个数组中获取唯一的数组键或列
- php - 访问 HTML 模板 PHP 上的会话变量
- ruby-on-rails - Net::SMTPSyntaxError · 501 无效命令或无法从地址解析
- javascript - javascript中的异步等待sqlite
- python - 使用来自另一个笔记本的动态名称/字符串运行 jupyter notebook
- c++ - 我怎样才能声明'''向量
''' 用于使用 C++/CLR 环境的 OpenCV 中的轮廓? - jenkins - “java.lang.IllegalArgumentException:预期关闭或失败”运行并行构建时出现异常
- android - AutoCompleteTextView onItemClickListener 未触发
- c++ - 有没有办法使用 QJsonObject 在整个 json 文件中找到一个键?
- javascript - 如何更改图像宽度以填充所有容器,或将其对齐到中心?