重命名的示例

這裡是關於檔案重新命名的部分。
自訂檔案重新命名模式

我剛想到幾個方法,也許你可以只用一個任務就搞定。

1 - 使用 PostCustomCommand。(可能比第二個選項複雜一點)
你可以寫一支腳本,利用參數把檔案搬到該去的地方。
可用的變數在這裡:
執行自訂命令

舉例來說,你可以寫一支叫 moveTVShows.ps1 的 PostCustomCommand 腳本,帶一個 isMovie 參數(目前沒有 isTVShow 變數),把 %ismovie% 傳進去;如果為 false 就知道要處理,否則跳過。腳本裡再用 %destinationpath% 與 %convertedfilename% 組合出要搬的檔案與目標路徑。

設定檔範例(使用 PowerShell Core):

PostCustomCommandPath="C:\Program Files\PowerShell\7\pwsh.exe"
PostCustomCommandParameters="path to ps1 script file" -isMovie %ismovie% -DestinationPath "%destinationpath%" -DestinationFileBaseName "%convertedfilename%"
PostCustomCommandHangPeriod=0
PostCustomCommandCritical=false
PostCustomCommandUISession=false
PostCustomCommandShowWindow=false
PostCustomCommandExitCodeCheck=false

2 - 排程工作定時把電影伺服器 TV 資料夾的檔案搬到電視伺服器的 TV 資料夾,用 robocopy 很簡單。下面範例可能需要微調,我好久沒用 robocopy 了。

robocopy.exe "\\MovieServer\Plex\TV" "\\TVServer\Plex\TV" /S /MOV /V /NP