folders with .'s at the end gave errors

This commit is contained in:
Jeroen De Meerleer 2019-03-16 14:52:48 +01:00
parent b4ee0ccfcf
commit dd38f38e89
1 changed files with 5 additions and 4 deletions

View File

@ -206,13 +206,14 @@ CreateFileList() {
sourcepath="${1/\[/\\\[}/*"
sourcepath="${sourcepath/\]/\\\]}"
for file in $sourcepath; do
relfile="${file#"$1/"}"
if [[ -d "${1}/$relfile" ]]; then
origfile="${file#"$1/"}"
relfile=$(echo ${origfile} | sed -e 's/\(\.\)*$//g')
if [[ -d "${1}/$origfile" ]]; then
newdir="${3}/$relfile"
newdir=${newdir#"/"}
VerboseOutput 1 "Entering $newdir"
CreateFileList "${1}/$relfile" "${2}/$relfile" "$newdir"
elif [[ ! -f "${2}/$relfile" || "${1}/$relfile" -nt "${2}/$relfile" ]]; then
CreateFileList "${1}/$origfile" "${2}/$relfile" "$newdir"
elif [[ "${1}/$origfile" != *".m3u" ]] && [[ ! -f "${2}/$relfile" || "${1}/$origfile" -nt "${2}/$relfile" ]]; then
echo ${3}/$relfile >> /tmp/music-sync-filelist
VerboseOutput 2 "Added: ${3}/${relfile}"
fi