guard against two level subdir moves

this has never worked since the -wholename check only works for
one level deep
This commit is contained in:
Girish Ramakrishnan
2022-06-08 12:24:11 -07:00
parent 8cf0922401
commit 037f4195da
2 changed files with 12 additions and 7 deletions

View File

@@ -27,7 +27,7 @@ if [[ "${BOX_ENV}" == "test" ]]; then
fi
# copy and remove - this way if the copy fails, the original is intact
# the find logic is so that move to a subdir works (and we also move hidden files)
# the find logic is so that move to a one level subdir works (and we also move hidden files)
find "${source_dir}" -maxdepth 1 -mindepth 1 -not -wholename "${target_dir}" -exec cp -ar '{}' "${target_dir}" \;
find "${source_dir}" -maxdepth 1 -mindepth 1 -not -wholename "${target_dir}" -exec rm -rf '{}' \;
# this will fail if target is a subdir or if source is a mountpoint