【发布时间】:2016-12-02 10:12:32
【问题描述】:
几天前我已经问过这个问题,但没有人回答,我发现我的问题是什么......
我正在共享点服务器上创建一些文件夹,用于将文件排序到其中,如果我启动它,它会抛出并上传错误,因为(当我停止使用断点时)我看到我的 mkdir 命令没有抛出任何错误消息,但我也没有工作......
编辑:
我将 mkdir 更改为 New-Item -ItemTyoe 目录,因为我认为这样效果更好!
try {
#local file -> called "temporary" which will be created to down- & upload files (without this one the script won't work!!!)
New-Item -ItemType directory -Path $temp_local_file #it will be created on the paritition you entered at the top pf the program
#online files -> those files are created to have the same structure as in the template directory
New-Item -ItemType directory -Path $main_folder
New-Item -ItemType directory -Path $offer_folder
New-Item -ItemType directory -Path $delivery_folder
New-Item -ItemType directory -Path $order_folder
New-Item -ItemType directory -Path $review01_folder
} catch {
Write-Host -f Red "Folder konnten nicht erstellt werden!"
}
这里是上传:
try {
$webclient.DownloadFile($reviewcomments, $review_download)
$webclient.DownloadFile($internal_project, $internal_project_download)
$webclient.DownloadFile($classification_document, $classification_download)
if($AVBInbox.Text -eq $AVB_languages[1]) {
$webclient.DownloadFile($AVB_en, $AVB_en_download)
Write-Host -f Green "Succesfully downloaded the english AVB"
}
elseif($AVBInbox.Text -eq $AVB_languages[0]) {
$webclient.DownloadFile($AVB_de, $AVB_de_download)
Write-Host -f Green "Succesfully downloaded the german AVB"
} else {
Show-MessageBox -Type Error -Message "An Error happened during the download of the AVB!"
}
} catch {
Write-Host -f Red "File Download failed, please retry!"
Show-MessageBox -Type Error -Message "Download failed please retry!"
}
如果有人有建议,我会感谢他或她:D
【问题讨论】:
-
它是哪一个:“它不起作用” 或 “它确实起作用了,但通过 web 客户端无法立即看到”?
-
它没有抛出任何错误,但真正的问题是我有一个路径,我认为他有一个问题 `\\workspace\DavWWWRoot\content\00000100\Research\ TestOffer\documents`
-
因为他抛出了一个找不到网络路径的错误,而且我花了好几年才打开这条路径,所以我认为它很慢
-
访问网络路径前使用test-connection。
标签: powershell sharepoint sharepoint-2007 powershell-2.0