how to move around files using "ls -al" result in Linux?

I've just invested some time to try this and came up with the following script:

#!/bin/bash
# set folder where files are located
SOURCE_FOLDER=/path/to/source

# define folder to which the files have to be copied
TARGET_FOLDER=/home/abcd

# ####
cd "${SOURCE_FOLDER}"
for FILE in *; do
    # everything which is not a normal file
    if [ ! -f "${FILE}" ]; then
        echo "Skipping non-file: '${FILE}'"
        continue
    fi

    # extract data from file structure
    FILE_DATE=$(date -r "$FILE" '+%Y-%m')
    FILE_DAY=$(date -r "$FILE" '+%d')
    FILE_PREFIX=${FILE%%_*}

    # skip files which do not match the naming convention
    if [ "${FILE_PREFIX}" = "" -o "${FILE_PREFIX}" = "${FILE}" ]; then
        echo "Skipping file with wrong naming: '${FILE}'"
        continue
    fi

    # create target folder
    TARGET="${TARGET_FOLDER}/${FILE_PREFIX}/${FILE_DATE}/${FILE_DAY}"
    echo "Copy '$FILE' to ${TARGET}"
    mkdir -p "${TARGET}"
    cp "$FILE" "$TARGET"
done

It also covers a couple of special cases and probability checks.