$Sourcedir = "\\TV\video\"
$Destinationdir = "\\TV\storage\temp\"
$Star = "*"
$HighRes = "1280x720"
$StdRes = "720x480"
$Resolution = $HighRes
$Homedir = "~"
Set-Location $Sourcedir
Get-ChildItem | Sort-Object @{Expression={$_.LastWriteTime}; Descending=$false} | Format-List -property name > temp.txt
$Source0 = Get-Content temp.txt | Where-Object {$_.trim()}
$Source1 = New-Object object[] $Source0.Length
$Destination = New-Object object[] $Source0.Length
for ( $i = 1; $i -le $Source0.Length; $i++ )
{
$Source1[$i - 1] = $Source0[$i - 1] -replace "Name : ", ""
$SS = $Sourcedir + $Source1[$i - 1]
switch ($Source1[$i - 1]) {
{$_ -match "100分de名著"} { $Destinationdir = "\\TV\storage\*100分de名著\" ; $Resolution = $HighRes ; break }
{$_ -match "ETV特集"} { $Destinationdir = "\\TV\storage\*ETV特集\" ; $Resolution = $StdRes ; break }
{$_ -match "NHK高校講座"} { $Destinationdir = "\\TV\storage\*NHK高校講座\" ; $Resolution = $StdRes ; break }
{$_ -match "NHKスペシャル"} { $Destinationdir = "\\TV\storage\*NHKスペシャル\" ; $Resolution = $HighRes ; break }
{$_ -match "コズミック"} { $Destinationdir = "\\TV\storage\コズミックフロント\" ; $Resolution = $HighRes ; break }
{$_ -match "サイエンスZERO"} { $Destinationdir = "\\TV\storage\*サイエンスZERO\" ; $Resolution = $HighRes ; break }
{$_ -match "すイエんサー"} { $Destinationdir = "\\TV\storage\*すイエんサー\" ; $Resolution = $HighRes ; break }
{$_ -match "スーパープレゼンテーション"} { $Destinationdir = "\\TV\storage\*スーパープレゼンテーション\" ; $Resolution = $HighRes ; break }
{$_ -match "タモリ倶楽部"} { $Destinationdir = "\\TV\storage\*タモリ倶楽部\" ; $Resolution = $HighRes ; break }
{$_ -match "ハートネットTV"} { $Destinationdir = "\\TV\storage\ハートネットTV\" ; $Resolution = $HighRes ; break }
{$_ -match "皇室アルバム"} { $Destinationdir = "\\TV\storage\皇室アルバム\" ; $Resolution = $HighRes ; break }
{$_ -match "新日本風土記"} { $Destinationdir = "\\TV\storage\新日本風土記\" ; $Resolution = $HighRes ; break }
{$_ -match "探検バクモン"} { $Destinationdir = "\\TV\storage\探検バクモン\" ; $Resolution = $HighRes ; break }
{$_ -match "白熱教室"} { $Destinationdir = "\\TV\storage\白熱教室\" ; $Resolution = $HighRes ; break }
{$_ -match "歴史秘話ヒストリア"} { $Destinationdir = "\\TV\storage\歴史秘話ヒストリア\" ; $Resolution = $HighRes ; break }
{$_ -match "連続テレビ小説 とと姉ちゃん"} { $Destinationdir = "\\TV\storage\*連続テレビ小説 とと姉ちゃん\" ; $Resolution = $HighRes ; break }
{$_ -match "プレミアムシネマ"} { $Destinationdir = "\\TV\storage\映画\" ; $Resolution = $HighRes ; break }
{$_ -match "金曜ロードSHOW!"} { $Destinationdir = "\\TV\storage\映画\" ; $Resolution = $HighRes ; break }
{$_ -match "NARUTO疾風伝"} { $Destinationdir = "\\TV\storage\アニメ\*NARUTO疾風伝\" ; $Resolution = $HighRes ; break }
{$_ -match "アンパンマン"} { $Destinationdir = "\\TV\storage\アニメ\*アンパンマン\" ; $Resolution = $HighRes ; break }
{$_ -match "ウォレスとグルミット"} { $Destinationdir = "\\TV\storage\アニメ\*ウォレスとグルミット\" ; $Resolution = $HighRes ; break }
{$_ -match "おさるのジョージ"} { $Destinationdir = "\\TV\storage\アニメ\*おさるのジョージ\" ; $Resolution = $HighRes ; break }
{$_ -match "クレヨンしんちゃん"} { $Destinationdir = "\\TV\storage\アニメ\*クレヨンしんちゃん\" ; $Resolution = $HighRes ; break }
{$_ -match "サザエさん"} { $Destinationdir = "\\TV\storage\アニメ\*サザエさん\" ; $Resolution = $StdRes ; break }
{$_ -match "ちびまる子ちゃん"} { $Destinationdir = "\\TV\storage\アニメ\*ちびまる子ちゃん\" ; $Resolution = $StdRes ; break }
{$_ -match "ドラえもん"} { $Destinationdir = "\\TV\storage\アニメ\*ドラえもん\" ; $Resolution = $HighRes ; break }
{$_ -match "ドラゴンボールZ"} { $Destinationdir = "\\TV\storage\アニメ\*ドラゴンボールZ\" ; $Resolution = $StdRes ; break }
{$_ -match "ドラゴンボール超"} { $Destinationdir = "\\TV\storage\アニメ\*ドラゴンボール超\" ; $Resolution = $HighRes ; break }
{$_ -match "ひつじのショーン"} { $Destinationdir = "\\TV\storage\アニメ\ひつじのショーン\" ; $Resolution = $HighRes ; break }
{$_ -match "ふるさと再生 日本の昔ばなし"} { $Destinationdir = "\\TV\storage\アニメ\*ふるさと再生 日本の昔ばなし\" ; $Resolution = $StdRes ; break }
{$_ -match "ポケットモンスター XY"} { $Destinationdir = "\\TV\storage\アニメ\*ポケットモンスターXY\" ; $Resolution = $HighRes ; break }
{$_ -match "ワンピース"} { $Destinationdir = "\\TV\storage\アニメ\*ワンピース\" ; $Resolution = $HighRes ; break }
{$_ -match "ARC-V"} { $Destinationdir = "\\TV\storage\アニメ\*遊戯王ARC-V\" ; $Resolution = $HighRes ; break }
{$_ -match "妖怪ウォッチ"} { $Destinationdir = "\\TV\storage\アニメ\*妖怪ウォッチ\" ; $Resolution = $HighRes ; break }
{$_ -match "フィニアス"} { $Destinationdir = "\\TV\storage\アニメ\*フィニアスとファーブ\" ; $Resolution = $HighRes ; break }
{$_ -match "ペンギンズ"} { $Destinationdir = "\\TV\storage\アニメ\*ペンギンズ\" ; $Resolution = $HighRes ; break }
{$_ -match "ルパン三世"} { $Destinationdir = "\\TV\storage\アニメ\*ルパン三世\" ; $Resolution = $HighRes ; break }
{$_ -match "みんなの手話"} { $Destinationdir = "\\TV\storage\*みんなの手話\" ; $Resolution = $HighRes ; break }
{$_ -match "ブラタモリ"} { $Destinationdir = "\\TV\storage\ブラタモリ\" ; $Resolution = $HighRes ; break }
{$_ -match "ラブライブ"} { $Destinationdir = "\\TV\storage\アニメ\*ラブライブ!\" ; $Resolution = $HighRes ; break }
{$_ -match "カンフー・パンダ"} { $Destinationdir = "\\TV\storage\アニメ\*カンフー・パンダ\" ; $Resolution = $HighRes ; break }
{$_ -match "ファンタシースターオンライン2"} { $Destinationdir = "\\TV\storage\アニメ\*ファンタシースターオンライン2\" ; $Resolution = $HighRes ; break }
{$_ -match "だがしかし"} { $Destinationdir = "\\TV\storage\アニメ\*だがしかし\" ; $Resolution = $HighRes ; break }
{$_ -match "昭和元禄落語心中"} { $Destinationdir = "\\TV\storage\アニメ\*昭和元禄落語心中\" ; $Resolution = $HighRes ; break }
{$_ -match "亜人"} { $Destinationdir = "\\TV\storage\アニメ\*亜人\" ; $Resolution = $HighRes ; break }
{$_ -match "助けて!きわめびと"} { $Destinationdir = "\\TV\storage\*助けて!きわめびと\" ; $Resolution = $HighRes ; break }
{$_ -match "みんなの手話"} { $Destinationdir = "\\TV\storage\*みんなの手話\" ; $Resolution = $HighRes ; break }
{$_ -match "チャリダー"} { $Destinationdir = "\\TV\storage\チャリダー\" ; $Resolution = $HighRes ; break }
{$_ -match "日本の話芸"} { $Destinationdir = "\\TV\storage\*日本の話芸\" ; $Resolution = $StdRes ; break }
{$_ -match "迷家"} { $Destinationdir = "\\TV\storage\アニメ\*迷家\" ; $Resolution = $HighRes ; break }
{$_ -match "少年メイド"} { $Destinationdir = "\\TV\storage\アニメ\*少年メイド\" ; $Resolution = $HighRes ; break }
{$_ -match "坂本ですが?"} { $Destinationdir = "\\TV\storage\アニメ\*坂本ですが?\" ; $Resolution = $HighRes ; break }
default { $Destinationdir = "\\TV\storage\その他\" ; $Resolution = $HighRes }
}
$Destination[$i - 1] = $Star + $Source1[$i - 1]
$DD = $Destinationdir + $Destination[$i - 1]
$DD = $DD.Replace(".ts", ".mp4")
Write-Output $DD
C:\Users\kanay_000\Downloads\ffmpeg-20160330-git-be746ae-win64-static\ffmpeg-20160330-git-be746ae-win64-static\bin\ffmpeg.exe -i $SS -s $Resolution $DD
}
Set-Location $Homedir