Open2
日常で使った1発ツールや作業内容のメモ
YouTubeの音楽ダウンロード
yt-dlpを使用してCLIで安定ダウンロードできる。
pipでインストールした。
yt-dlp -x --audio-format mp3 "<youtube-url>"
Windows で大容量フォルダの一括移動
- Windows 11 Pro
- 100GB以上のフォルダ複数(合計500GB)を一括で別ドライブに構造を維持したまま移動する
- 転送速度、スロットリング、予期せぬ中断を考慮してファイルを1つずつ順番に移動する
- 管理者ターミナルで実行
$sourceRoot = "C:\source"
$destRoot = "D:\destination"
$folders = Get-ChildItem -Path $sourceRoot -Directory
foreach ($folder in $folders) {
$sourceFolder = Join-Path $sourceRoot $folder.Name
$destFolder = Join-Path $destRoot $folder.Name
if (!(Test-Path $destFolder)) {
New-Item -Path $destFolder -ItemType Directory | Out-Null
}
Write-Host "Processing $folder.Name..."
$items = Get-ChildItem -Path $sourceFolder
foreach ($item in $items) {
$sourcePath = $item.FullName
$destPath = Join-Path $destFolder $item.Name
Write-Host " Moving: $item.Name"
Move-Item -Path $sourcePath -Destination $destPath
}
Write-Host "Finished $folder.Name`n"
}
Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned
.\move_files.ps1