我的腳本將一個目錄(和所有子目錄)複製到一個以今天的日期命名的新目錄中,以複製到10個不同的服務器。複製項錯誤:無法遵循符號鏈接,因爲它的類型被禁用
$ServerList = Get-Content 'C:\Users\test\Powershellskript\testservrar.txt'
ForEach ($Server in $ServerList)
{
$source = "\\$Server\C$\Java\testIX"
$distanation = "\\$Server\C$\Backup"
$today = (Get-Date).ToString('YY-MM-DD')
$location = New-Item -Path $distanation -Type Directory -Name $today
Copy-Item $source -Destination $location -recurse
}
但我得到了下面的兩個錯誤,我該如何解決這個問題?
Copy-Item : The symbolic link cannot be followed because its type is disabled. At C:\Users\baa065sa\Powershell skript\Untitled1.ps1:9 char:1
Copy-Item : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. At C:\Users\baa065sa\Powershell skript\Untitled1.ps1:9 char:1
爲什麼?我怎樣才能解釋錯誤? –
對不起,代碼沒有格式化,當我張貼,並沒有提供任何解釋,我刪除了我以前的評論 – Manu
它看起來像這裏有一個解決方案:https://stackoverflow.com/questions/229643/how-doi-i-克服這個符號鏈接不能被遵循,因爲它的類型是 –