Move files whose names contain a substring to directories with names containing the same substring

Viewed 21

Let's suppose we have something like this:

C:\
|
\---TEST
    |   File01
    |   File02
    |   File03
    |   FileFile01
    |
    +---01_John
    +---02_Smith
    \---03_Marc

I want to create a batch to move all files whose name contains 01, 02 & 03, for example, to the directory whose name contains the same substring.

Example result:

C:\
|
\---TEST
    |
    +---01_John
    |      File01
    |      FileFile01
    |
    +---02_Smith
    |      File02
    |
    \---03_Marc
           File03
0 Answers
Related