Created
May 20, 2023 16:27
-
-
Save risadams/c6a020d8e02af7bb82b8cb3b095a44ec to your computer and use it in GitHub Desktop.
Sort all files into alphanumeric folders based on the first letter of the file name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$list = @() | |
65..90 | ForEach-Object { | |
$letter = [char]$_ | |
New-Item -Path .\ -Name $letter -ItemType "directory" | |
move-item .\$letter`?* $letter | |
$list += $letter | |
} | |
$rest = get-childitem -path .\ -exclude $list | |
New-Item -Path .\ -Name "0-9" -ItemType "directory" | |
foreach ($f in $rest) { | |
move-item $f.fullname "0-9" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment