I've got 6 directories (A, B, C, D, E, F) containing .mov files.

The structure is:

**A**

```
-0001_01.mov

-0002_01.mov

-...

```

**B**

```
-0001_02.mov

-0002_02.mov

-...

```

And so on.

First, I want to create as many directories as there are files in one of the directories mentioned above.
Let's say A contains 35 .mov files (B, C .. contain the same amount of .mov files).
I now got 35 folders starting from "01" up to "35".

Now I want to copy each corresponding .mov file into the same directory, which means 0001\_01.mov - 0001\_06.mov go into "01", 0002\_01.mov - 0002\_06.mov go into "02" and so on.

I've got the creation of the directories working, but I just can't wrap my head around the copying part.

```
import os

pathA = ("./A/")
pathB = ("./B/")
pathC = ("./C/")
pathD = ("./D/")
pathE = ("./E/")
pathF = ("./F/")

path, dirs, filesA = next(os.walk(pathA))
file_countA = len(filesA)
path, dirs, filesB = next(os.walk(pathB))
file_countB = len(filesB)
path, dirs, filesC = next(os.walk(pathC))
file_countC = len(filesC)
path, dirs, filesD = next(os.walk(pathD))
file_countD = len(filesD)
path, dirs, filesE = next(os.walk(pathE))
file_countE = len(filesE)
path, dirs, filesF = next(os.walk(pathF))
file_countF = len(filesF)

path2 = ("./")

if file_countA == file_countB == file_countC == file_countD == file_countE == file_countF:
    print("true")
else:
    print ("false")

for i in range(file_countA):
    try:

        if i < 9:
            os.mkdir(path2 + "0" + str(i + 1))
            path3 = ("./" + "0" + str(i + 1))
            print (path3)

        elif i >= 9:
            os.mkdir(path2 + str(i + 1))
            path3 = ("./" + str(i + 1))
            print (path3)

    except OSError:
        print ("Creation of the directory %s failed" % path2)
    else:
        print ("Successfully created the directory %s " % path2)

```

This is my first time using python, I think the code reflects that.
I've now wasted countless hours on this, so any help is appreciated.