动脑筋,但我不明白怎么了。我有代码:
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
为什么我看不到文件和文件大小(顺便说一句,该脚本不能复制文件)