From e31505173a288a50baba6cee053b25851afabc4c Mon Sep 17 00:00:00 2001 From: pcnick Date: Sat, 20 Apr 2024 19:28:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9D=E7=9B=AE=E6=A8=99=E6=AA=94=E6=A1=88?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E8=AE=8A=E6=9B=B4=E7=9B=AE=E9=8C=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Animelibk.ps1 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Animelibk.ps1 b/Animelibk.ps1 index 40b27be..b16681e 100644 --- a/Animelibk.ps1 +++ b/Animelibk.ps1 @@ -91,8 +91,19 @@ $Lang = @{ } $Year = @($($JsonPath -replace '.*\\((?\d{4})?(?\d{2})?).*$', '${Y}'), $(get-date -Format 'yyyy')) | ? {-not([string]::IsNullOrEmpty($_))} | Select -First 1 +# 依目標檔案位置變更磁碟代號 +$TargetDrive = Split-Path -Path $JsonPath -Qualifier +if (Split-Path -Path $Index -IsAbsolute) { + if ($Index -match $TargetDrive) { + $Index2 = Join-Path -Path $TargetDrive -ChildPath (Split-Path -Path $Index -noQualifier) + } else { + $Index2 = $Index + } +} else { + $Index2 = Join-Path $TargetDrive $Index +} # 取得目標資料夾是否存在,不存在建立資料夾,並取得資料夾物件 -$LinkPath = "{2}\{0}\{1}" -f $WorkData.DestinName, $($Lang["Season"] -f $WorkData.Season), $Index +$LinkPath = "{2}\{0}\{1}" -f $WorkData.DestinName, $($Lang["Season"] -f $WorkData.Season), $Index2 $LinkDir = $(if (-not(Test-Path -Path "$LinkPath*")) { New-Item -Path "$LinkPath ($Year)" -ItemType Directory -Force } else {