def main():
    ref_date = 0
    rel_dir = ''
    dirstring = e('${BE_ROOT}/release/${PRODUCT}')
    for x in glob.glob("{0}*".format(dirstring)):
        if e('${BUILD_ARCH_SHORT}') not in os.listdir(x):
            continue

        if os.lstat(x).st_ctime > ref_date:
            ref_date = os.lstat(x).st_ctime
            rel_dir = x

    if not rel_dir:
        error('Release not found')

    if e('${BUILD_TYPE}').lower() in ["master", "stable"]:
        appending_path = e('${VERSION_NUMBER}/${BUILD_TYPE}')
    else:
        appending_path = e('${VERSION_NUMBER}')
    internal_path = os.path.join(e('${IX_INTERNAL_PATH_PREFIX}'), appending_path)
    if os.path.exists(internal_path):
        internal_path = os.path.join(internal_path, os.path.basename(rel_dir))
        sh('cp -r ${rel_dir} ${internal_path}')
dataset/ETHPy150Open freenas/freenas-build/build/tools/post-to-storage.py/main/original