반응형

탐색기를 열어서 원하는 폴더로 이동한 후 마우스 오른쪽 버튼 눌러서 터미널 실행.

 

아래 코드 붙여넣고 실행하기

 

Get-ChildItem -File | ForEach-Object {
    # 확장자 뺀 이름
    $name = [System.IO.Path]::GetFileNameWithoutExtension($_.Name)

    # 폴더 만들기(있으면 무시)
    New-Item -ItemType Directory -Force -Name $name | Out-Null

    # 파일을 해당 폴더로 이동
    Move-Item -LiteralPath $_.FullName -Destination (Join-Path -Path . -ChildPath $name)
}

반응형

+ Recent posts