我使用當前代碼下載從SharePoint文件文件...PowerShell的比較本地文件的大小,在SharePoint
$webClient = New-Object System.Net.WebClient
$webClient.UseDefaultCredentials = $true
$webClient.DownloadFile($sharepointPathFile, $localPathFile) | Out-Null
但如果我想檢查該文件是否已經在哪當地的位置和大小相符還是不同?我將如何使用PowerShell來做到這一點?
更新
這是最接近我能得到...
$url = $sharepointPathFile
$clnt = [System.Net.WebRequest]::Create($url)
$resp = $clnt.GetResponse()
$fileSize = $resp.ContentLength
Write-Host $fileSize
但我收到以下錯誤:
Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (401) Unauthorized."
At C:\Scripts\Tests\testCheckUpdatedSearchFiles.ps1:345 char:2
+ $resp = $clnt.GetResponse()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
我有充分的讀取和下載權限,所以有沒有其他的東西不在這裏?
,我猜你要回答自己的問題在一點點後,對自己的實際做了一些研究... – dfundako
抱歉,它看起來像我這次實際上卡住了...我真的不熟悉與共享點的工作,我的地方是確保我在這裏沒有任何管理員(使開發腳本變得困難)。 –