0

I have files like these

(ok) C.H.U.D. (1984) [ITA - ENG] - Director's Cut - DVDMux by ErTenebra.avi
[2001] Disney - Ricreazione - La scuola è finita.avi
Arena (1989) [ITA - ENG] DVDMux by ErTenebra.mkv

This script

Get-ChildItem -File -Path * |
  Where-Object {$_.Extension -ne ".ps1"} |
  ForEach-Object {
    $targetDir = Join-Path $_.Directory.FullName $_.Name[0]
    if (-not (Test-Path $targetDir)) {
      New-Item -ItemType Directory -Path $targetDir
    }
    Move-Item -Path $_.FullName -Destination $targetDir
  }

creates these folders

(
[
A

but files are not moved inside. For example I want that

(ok) C.H.U.D. (1984) [ITA - ENG] - Director's Cut - DVDMux by ErTenebra.avi

be moved to the folder

(

I want that

[2001] Disney - Ricreazione - La scuola è finita.avi

be moved to the folder

[

and so on.

user3520363
  • 360
  • 1
  • 15
  • 2
    Use `-LiteralPath` when filenames have `[]` characters, but do you **really** want foldernames like that? – Theo Feb 22 '23 at 21:44

0 Answers0