[script] functionalize directory appending