|
|
@ -91,8 +91,19 @@ $Lang = @{ |
|
|
|
} |
|
|
|
} |
|
|
|
$Year = @($($JsonPath -replace '.*\\((?<Y>\d{4})?(?<M>\d{2})?).*$', '${Y}'), $(get-date -Format 'yyyy')) | ? {-not([string]::IsNullOrEmpty($_))} | Select -First 1 |
|
|
|
$Year = @($($JsonPath -replace '.*\\((?<Y>\d{4})?(?<M>\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*")) { |
|
|
|
$LinkDir = $(if (-not(Test-Path -Path "$LinkPath*")) { |
|
|
|
New-Item -Path "$LinkPath ($Year)" -ItemType Directory -Force |
|
|
|
New-Item -Path "$LinkPath ($Year)" -ItemType Directory -Force |
|
|
|
} else { |
|
|
|
} else { |
|
|
|