Removing final dots in dest

This commit is contained in:
Jeroen De Meerleer 2019-07-01 12:34:43 +02:00
parent 72d8a2dcff
commit 99a2ab4784
1 changed files with 7 additions and 7 deletions

View File

@ -250,14 +250,14 @@ CreateFileList() {
VerboseOutput 0 "Checking ${origfile}" VerboseOutput 0 "Checking ${origfile}"
if [[ -d "${1}/$origfile" ]]; then if [[ -d "${1}/$origfile" ]]; then
VerboseOutput 0 "${origfile} is folder" VerboseOutput 0 "${origfile} is folder"
newdir="${3}/$relfile" newdir="${3}/$origfile"
newdir=${newdir#"/"} newdir=${newdir#"/"}
VerboseOutput 1 "Entering $newdir" VerboseOutput 1 "Entering $newdir"
CreateFileList "${1}/$origfile" "${2}/$relfile" "$newdir" CreateFileList "${1}/$origfile" "${2}/$relfile" "$newdir"
elif [[ "${1}/$origfile" != *".m3u" ]] && [[ ! -f "${2}/$relfile" || "${1}/$origfile" -nt "${2}/$relfile" ]]; then elif [[ "${1}/$origfile" != *".m3u" ]] && [[ ! -f "${2}/$origfile" || "${1}/$origfile" -nt "${2}/$relfile" ]]; then
echo ${3}/$relfile >> /tmp/music-sync-filelist echo ${3}/$origfile >> /tmp/music-sync-filelist
VerboseOutput 0 "${origfile} is newer in source" VerboseOutput 0 "${origfile} is newer in source"
VerboseOutput 1 "Added: ${3}/${origfile}" VerboseOutput 2 "Added: ${3}/${origfile}"
fi fi
if [[ "${1}/$origfile" == *".m3u" ]]; then if [[ "${1}/$origfile" == *".m3u" ]]; then
VerboseOutput 0 "${origfile} is playlist" VerboseOutput 0 "${origfile} is playlist"
@ -334,16 +334,16 @@ CopyFiles() {
total=$(cat /tmp/music-sync-filelist | wc -l) total=$(cat /tmp/music-sync-filelist | wc -l)
percentage=$(echo "scale=4;${curline}/${total}" | bc) percentage=$(echo "scale=4;${curline}/${total}" | bc)
percentage=$(echo "scale=2;${percentage}*100" | bc) percentage=$(echo "scale=2;${percentage}*100" | bc)
destline=$(echo $line | sed -e 's/\.*\//\//g')
VerboseOutput 1 "Copying: $line" VerboseOutput 1 "Copying: $line"
VerboseOutput 2 "Progress: $curline / $total (${percentage%00}%) Step 2 of 2" VerboseOutput 2 "Progress: $curline / $total (${percentage%00}%) Step 2 of 2"
if [[ "$dest/$line" = */* ]]; then if [[ "$dest/$line" = */* ]]; then
VerboseOutput 0 "Creating folder $dest/${line%/*}" VerboseOutput 0 "Creating folder $dest/${line%/*}"
mkdir -p "$dest/${line%/*}"; mkdir -p "$dest/${destline%/*}";
fi; fi;
cp -f $temp/$line $dest/$line 1>/dev/null 2>/dev/null cp -f $temp/$line $dest/$destline 1>/dev/null 2>/dev/null
VerboseOutput 2 "Copied: $line" VerboseOutput 2 "Copied: $line"