Skip to content

Instantly share code, notes, and snippets.

@telfaria
Last active April 3, 2018 17:36
Show Gist options
  • Select an option

  • Save telfaria/2d6b69bcb89e52883f59de75b850989f to your computer and use it in GitHub Desktop.

Select an option

Save telfaria/2d6b69bcb89e52883f59de75b850989f to your computer and use it in GitHub Desktop.
フォルダ名からタイトルを検索して移動するPowerShellスクリプト
$Folders = Get-ChildItem * | Where-Object { $_.PSIsContainer}
foreach($dName in $Folders)
{
echo "Search: $dName"
$title = $dname.Name
$targerfiles = Get-ChildItem *.MP4
foreach($file in $targerfiles)
{
if ($file.Name -like "*$title*")
{
Move-Item -LiteralPath $file.name -Destination $dname.FullName -Verbose
}
}
}
@telfaria

telfaria commented Apr 3, 2018

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment