#UUID=$(cat /proc/sys/kernel/random/uuid)
UUID="U$(date +%s%N)"
NEW_FILENAME=${FILENAME=//:}_${UUID}.${EXT,,}
mv -n ${FILE} ${TARGET}/${YEAR}/${YEAR}.${MONTH}/${NEW_NAME}
let PROGRESS++
echo -ne "$((${PROGRESS} * 100 / ${TOTAL_FILES_COUNTER}))%\033[0K\r"
# Remove the moved file from the array
let FILES_COUNTER--
FILES_ARR=("${FILES_ARR[@]/$FILE}")
The move command mv in line 247 does not use the modified filename (NEW_FILENAME) but the duplicate filename NEW_NAME. Because the file name NEW_NAME already exists, mv does not do anything.
Additional issue: the filename NEW_FILENAME is the old filename instead of the modified one. Therefore, I propose the following modifications:
# Generate a unique ID
#UUID=$(cat /proc/sys/kernel/random/uuid)
UUID="U$(date +%s%N)"
NEW_NAME=${DATE//:}_${TIME//:}_${UUID}.${EXT,,}
mv -n ${FILE} ${TARGET}/${YEAR}/${YEAR}.${MONTH}/${NEW_NAME}
let PROGRESS++
echo -ne "$((${PROGRESS} * 100 / ${TOTAL_FILES_COUNTER}))%\033[0K\r"
# Remove the moved file from the array
let FILES_COUNTER--
FILES_ARR=("${FILES_ARR[@]/$FILE}")
Old lines:
Generate a unique ID
The move command mv in line 247 does not use the modified filename (NEW_FILENAME) but the duplicate filename NEW_NAME. Because the file name NEW_NAME already exists, mv does not do anything. Additional issue: the filename NEW_FILENAME is the old filename instead of the modified one. Therefore, I propose the following modifications: