AtOM/lib/copy/matching
2013-10-09 01:30:47 +02:00

34 lines
900 B
Bash

#!/bin/bash
copyFiles_matching() {
extension="${filename##*.}"
cp -al \
"$sourcepath/$filename" \
"$destdir/$destfile.$extension" \
2>/dev/null \
|| cp -a \
"$sourcepath/$filename" \
"$destdir/$destfile.$extension"
echo \
"UPDATE destination_files" \
"SET filename=" \
"\"${destdir//\"/\"\"}/${destfile//\"/\"\"}.$extension\"," \
" last_change=(" \
" SELECT last_change" \
" FROM source_files" \
" WHERE id=$fileid" \
" )," \
" old_filename=(" \
" SELECT filename" \
" FROM destination_files" \
" WHERE id=$destfileid" \
" )," \
" rename_pattern" \
"\"${destinationrenamepath[$destination]}/${destinationrename[$destination]}\""\
" fat32compat" \
" ${destinationfat32compat["$destination"]}"\
" ascii ${destinationascii["$destination"]}"\
"WHERE id=$destfileid;" \
>&3
(( ++copies ))
}