Handling special char names

This commit is contained in:
Jeroen De Meerleer 2018-12-01 09:38:03 +01:00
parent ad6bc38c02
commit a0d0d30989

View File

@ -167,7 +167,8 @@ CreateFileList() {
# ${2} /mnt/mtp/Example-Artist/Example-Album
# ${3} Example-Artist/Example-Album
IFS=""
sourcepath="${1}/*"
sourcepath="${1/\[/\\\[}/*"
sourcepath="${sourcepath/\]/\\\]}"
for file in $sourcepath; do
relfile="${file#"$1/"}"
if [[ -d "${1}/$relfile" ]]; then
@ -187,6 +188,7 @@ ConvertFiles() {
percentage=0
while read -r line
do
if [[ ! -f "${source}/$line" ]]; then
VerboseOutput 5 "Source-file ${source}/$line Unreachable"
ExecTime
@ -218,13 +220,13 @@ CopyFiles() {
percentage=0
while read -r line
do
if [[ ! -f "$dest" ]]; then
if [[ ! -d "$dest" ]]; then
VerboseOutput 5 "Destination unreachable"
ExecTime
exit 4
fi
if [[ ! -f "$line" ]]; then
if [[ ! -f "${temp}/$line" ]]; then
VerboseOutput 5 "Source-file ${temp}/$line Unreachable"
ExecTime
exit 3
@ -234,6 +236,7 @@ CopyFiles() {
total=$(cat /tmp/music-sync-filelist | wc -l)
percentage=$(echo "scale=4;${curline}/${total}" | bc)
percentage=$(echo "scale=2;${percentage}*100" | bc)
VerboseOutput 1 "Copying: $line"
VerboseOutput 2 "Progress: $curline / $total (${percentage%00}%) Step 2 of 2"