Can anyone help with this home project?
I'm attempting to sort a 500gb+ directory full of random files.
I'd like to sort these files into sub-directories named 'A', 'B', 'C'..., '1', '2', '3'...
###################################################
# I've created a test directory to try my script against
###################################################
<# Start 7/4/2017 #>
Set-Location 'D:\IT Notes\psroot'
<# Make directories A..Z#>
65..90 | % {md ("{0}" -f [char]$_)}
<# Make a list of 0-9, A-Z, & a-z #>
$chars = [char[]] ([char]'0'..[char]'9' + [char]'A'..[char]'Z' + [char]'a'..[char]'z')
<# Use chars list to create random.txt file#>
(1..100).ForEach({-join (Get-Random $chars -Count 10) | Add-Content random.txt })
<# Save random.txt list to a variable#>
$random = (Get-Content .\random.txt)
<# Create files & add .txt extension #>
New-Item $random -ItemType file | Rename-Item -NewName {$_.name + ".txt"}
###################################################
Now how do I sort everything into their respected directory?
Thanks for your help in advance!