diff --git a/lgsm/functions/command_fastdl.sh b/lgsm/functions/command_fastdl.sh index 0c763808a..c09250217 100644 --- a/lgsm/functions/command_fastdl.sh +++ b/lgsm/functions/command_fastdl.sh @@ -336,17 +336,21 @@ fn_fastdl_source(){ tput rc; tput el printf "copying ${directory} ${allowed_extention} : ${fileswc}..." fn_sleep_time - if [ ! -d "${fastdldir}/${directory}" ]; then - mkdir "${fastdldir}/${directory}" + # get relative path of file in the dir + tmprelfilepath="${fastdlfile#"${systemdir}/"}" + copytodir="${tmprelfilepath%/*}" + # create relative path for fastdl + if [ ! -d "${fastdldir}/${copytodir}" ]; then + mkdir -p "${fastdldir}/${copytodir}" fi - cp "${fastdlfile}" "${fastdldir}/${directory}" + cp "${fastdlfile}" "${fastdldir}/${copytodir}" exitcode=$? if [ ${exitcode} -ne 0 ]; then fn_print_fail_eol_nl - fn_script_log_fatal "Copying ${fastdlfile} > ${fastdldir}/${directory}" + fn_script_log_fatal "Copying ${fastdlfile} > ${fastdldir}/${copytodir}" core_exit.sh else - fn_script_log_pass "Copying ${fastdlfile} > ${fastdldir}/${directory}" + fn_script_log_pass "Copying ${fastdlfile} > ${fastdldir}/${copytodir}" fi done < <(find "${systemdir}/${directory}" -type f -iname ${allowed_extention}) if [ ${fileswc} != 0 ]; then