Last active
November 19, 2015 08:58
-
-
Save alantsai/68cac9cff770b7701268 to your computer and use it in GitHub Desktop.
Windows Phone無法用資料夾來區分影片,因此只能夠用檔名。而檔名通常沒有到資料夾層級。因此,這個Powershell script用資料夾前2個字元(通常表示那個章節)加上本身檔名讓整個做grouping。
#powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 範例資料結構 | |
# 原本是: | |
# 01 Chapter1/01.xxx.mp4 | |
# 01 Chapter1/02.xxx.mp4 | |
# 02 Chapter2/01.xxx.mp4 | |
# 02 Chapter2/02.xxx.mp4 | |
# | |
# 執行完: | |
# 01 Chapter1/01_01.xxx.mp4 | |
# 01 Chapter1/01_02.xxx.mp4 | |
# 02 Chapter2/02_01.xxx.mp4 | |
# 02 Chapter2/02_02.xxx.mp4 | |
dir -recurse -file | | |
ren -NewName {$_.Directory.Name.SubString(0,2) + | |
"_" + $_.Name} -whatif | |
# 沒有Whatif 版本(直接執行) | |
dir -recurse -file | | |
ren -NewName {$_.Directory.Name.SubString(0,2) + | |
"_" + $_.Name} | |
# 拉平版本 - 方便貼上powershell直接修改要的值 | |
dir -recurse -file | ren -NewName {$_.Directory.Name.SubString(0,2) + "_" + $_.Name} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment