2

I have a folder containg nearly 2000 sub-folders. To make it easier to navigate, I'd like an automated way (I have many folders like this) to organise them by starting letter, with 27 sub-folders (A-Z and one for 0-9 and other characters). So rather than

.
Aardvark/
  Aardvark_files
Apple/
  Apple_files
Banana/
  Banana_files
etc.

It'd be;

.
A/
  Aardvark/
    Aarvark_files
  Apple/
    Apple_files
B/
  Banana/
    Banana_files
etc.

I'm using Windows 7.

Any help is much appreciated! Thanks.

2
  • Someone should logon remotely and move them ? What is the actual problem.
    – phil soady
    Apr 25, 2015 at 14:01
  • I need a script or something to do it automatically. I'm going to be doing this for LOTS of folders.
    – jacoman891
    Apr 25, 2015 at 14:37

2 Answers 2

8

run a powershell script here a quick hack. it gives you folders a-z and one called "rest". Make sure there are no folders called that way before running the script. And make a backup

the script should be optimized if you gone use it more than once.

$list = @()
97..122 | foreach {
    $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 "rest" -ItemType "directory"

foreach ($f in $rest) {
    move-item  $f.fullname "rest"
}
1
  • It took me too much time to find a script running without tweaking. Thank you so much! Jun 15, 2022 at 9:01
-2

In XP "Sort " in the commandline had the tools to do what you wanted. The worst case is 26 sorts with short fairlt easy coomand lines (plus numerical/special character sorts as required) , but I think it could do the sorts you wish in one dommandline but it would be a long ugly string of syntax by the time you got it right.

Anyway here is the Sort syntax page for XP. I do not know if it is the same thing or similar in other versions of windows but I suspect microsoft would not change it until forced.

https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sort.mspx?mfr=true

1
  • The sort command sorts text, either the contents of a file or output of a command or user input. It doesn't sort files into sub-folders. If you can explain how sort can actually accomplish what the OP wants I will upvote.
    – Karan
    Apr 25, 2015 at 21:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .