merge child directory into parent directory structure python -


i have directory structure...

└── 01048     └── 2014         └── in 

i want merge directory structure...

└── 01048     └── 2014         └── ar         └── ab 

to make directory structure...

└── 01048     └── 2014         └── in         └── ar         └── ab 

i've tried shutil.move("../scr_path/01048", "../destination_path/01048") results in...

└── 01048     └── 01048         └── 2014             └── ar             └── ab     └── 2014         └── in 

you should try-out shutil.move , along os.listdir() move directories.

example -

import os, os.path import shutil src in os.listdir('../scr_path/01048'):     s = os.path.join('../scr_path/01048',src)     d = os.path.join('../destination_path/01048',src)     src1 in os.listdir(s):         shutil.move(os.path.join(s,src1),d) 

Comments