import configparser
import os
import shutil

# *Setup replace path and static path
config = configparser.ConfigParser()
config.read('config.ini')
replace_path = config['DEFAULT']['replace_path']
static_path = config['DEFAULT']['static_path']

# *Replace dump folder with static scans
pcd_list = os.listdir(static_path)
pcd_list.sort()
id = 0
for pcd in pcd_list:
    cloud_path = os.path.join(static_path, pcd)
    dir = '%06d' % id
    subfolder_path = os.path.join(replace_path, dir, "cloud.pcd")
    shutil.copy(cloud_path, subfolder_path)
    id = id + 1
