How do I sort files into folders, according to file names, using CMD / PowerShell commands?  

Let's say I have a folder containing a large amount of files (more than 20,000 files), where all the files have the same naming convention, e.g: (notice the pattern)  

```
t_1001_1801.png
t_1001_1802.png
t_1001_1803.png
...
t_1001_2112.png (last file starts with 't_1001_')
t_1002_1801.png
t_1002_1802.png
t_1002_1803.png
....
t_1002_2112.png
t_1003_1801.png
t_1003_1802.png
t_1003_1803.png
...
t_1214_2112.png (last file in folder)

```

I run this CMD command to create a list of folders:  

`for /l %i in (1001,1,1214) do md x%i`   

which creates a list of folders, e.g:  

```
x1001
x1002
x1003
...
x1214

```

Now I would like to sort (move) the files into the folders according to the files name, e.g:  

```
- move the files t_1001_1801.png to t_1001_2112.png to the folder x1001.
- move the files t_1002_1801.png to t_1002_2112.png to the folder x1002.
...

```

Can I use shell commands for this purpose?