move files copy
This commit is contained in:
parent
e9c47391cd
commit
0f52325ac0
74
atom
74
atom
@ -518,7 +518,7 @@ do
|
|||||||
getDestFile
|
getDestFile
|
||||||
if (( copied ))
|
if (( copied ))
|
||||||
then
|
then
|
||||||
copyFile
|
copyFiles_matching
|
||||||
else
|
else
|
||||||
encodeFile::${destinationformat[$destination]}
|
encodeFile::${destinationformat[$destination]}
|
||||||
fi
|
fi
|
||||||
@ -790,77 +790,7 @@ do
|
|||||||
unset count
|
unset count
|
||||||
done
|
done
|
||||||
|
|
||||||
echo '
|
copyFiles_action
|
||||||
SELECT
|
|
||||||
source_files.filename,
|
|
||||||
source_files.last_change,
|
|
||||||
destinations.id,
|
|
||||||
destination_files.id
|
|
||||||
FROM source_files
|
|
||||||
INNER JOIN destination_files
|
|
||||||
ON source_files.id
|
|
||||||
= destination_files.source_file_id
|
|
||||||
INNER JOIN destinations
|
|
||||||
ON destination_files.destination_id=destinations.id
|
|
||||||
INNER JOIN mime_type_actions
|
|
||||||
ON mime_type_actions.id = source_files.mime_type
|
|
||||||
WHERE CAST(destination_files.last_change AS TEXT)
|
|
||||||
<> CAST(source_files.last_change AS TEXT)
|
|
||||||
AND mime_type_actions.destination_id = destinations.id
|
|
||||||
AND mime_type_actions.action = 2;
|
|
||||||
|
|
||||||
SELECT "AtOM:NoMoreFiles";' >&3
|
|
||||||
read -u4 line
|
|
||||||
while ! [[ $line = AtOM:NoMoreFiles ]]
|
|
||||||
do
|
|
||||||
copyfiles+=("$line")
|
|
||||||
read -u4 line
|
|
||||||
done
|
|
||||||
|
|
||||||
for copyfile in "${copyfiles[@]}"
|
|
||||||
do
|
|
||||||
sourcefilename=${copyfile%%|*}
|
|
||||||
rest="${copyfile#*|}|"
|
|
||||||
lastchange=${rest%%|*}
|
|
||||||
rest=${rest#*|}
|
|
||||||
destinationid=${rest%%|*}
|
|
||||||
rest=${rest#*|}
|
|
||||||
destfileid=${rest%%|*}
|
|
||||||
rest=${rest#*|}
|
|
||||||
echo 'SELECT IFNULL( (
|
|
||||||
SELECT destination_files.filename
|
|
||||||
FROM destination_files
|
|
||||||
INNER JOIN source_files
|
|
||||||
ON destination_files.source_file_id=source_files.id
|
|
||||||
INNER JOIN mime_type_actions
|
|
||||||
ON
|
|
||||||
mime_type_actions.id=source_files.mime_type
|
|
||||||
INNER JOIN destinations
|
|
||||||
ON destinations.id=destination_files.destination_id
|
|
||||||
WHERE destinations.id = '$destinationid'
|
|
||||||
AND source_files.filename LIKE "'"${sourcefilename%/*}"'/%"
|
|
||||||
AND mime_type_actions.action = 1
|
|
||||||
LIMIT 1
|
|
||||||
),"AtOM:NotFound");
|
|
||||||
'>&3
|
|
||||||
read -u4 filename
|
|
||||||
if [[ $filename != AtOM:NotFound ]]
|
|
||||||
then
|
|
||||||
destdir=${filename%/*}
|
|
||||||
if cp -al "$sourcepath/$sourcefilename" "$destdir" 2>/dev/null\
|
|
||||||
|| cp -a "$sourcepath/$sourcefilename" "$destdir"
|
|
||||||
then
|
|
||||||
Update destination_files \
|
|
||||||
filename "$destdir/${sourcefilename##*/}"\
|
|
||||||
rename_pattern "${destinationrenamepath[$destination]}/${destinationrename[$destination]}:${destinationfat32compat["$destination"]}"\
|
|
||||||
<<-EOWhere
|
|
||||||
id = $destfileid
|
|
||||||
last_change = $lastchange
|
|
||||||
EOWhere
|
|
||||||
progressSpin
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
SELECT id,
|
SELECT id,
|
||||||
|
|||||||
73
lib/copy/copyFiles_action
Normal file
73
lib/copy/copyFiles_action
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
copyFiles_action() {
|
||||||
|
echo '
|
||||||
|
SELECT
|
||||||
|
source_files.filename,
|
||||||
|
source_files.last_change,
|
||||||
|
destinations.id,
|
||||||
|
destination_files.id
|
||||||
|
FROM source_files
|
||||||
|
INNER JOIN destination_files
|
||||||
|
ON source_files.id
|
||||||
|
= destination_files.source_file_id
|
||||||
|
INNER JOIN destinations
|
||||||
|
ON destination_files.destination_id=destinations.id
|
||||||
|
INNER JOIN mime_type_actions
|
||||||
|
ON mime_type_actions.id = source_files.mime_type
|
||||||
|
WHERE CAST(destination_files.last_change AS TEXT)
|
||||||
|
<> CAST(source_files.last_change AS TEXT)
|
||||||
|
AND mime_type_actions.destination_id = destinations.id
|
||||||
|
AND mime_type_actions.action = 2;
|
||||||
|
|
||||||
|
SELECT "AtOM:NoMoreFiles";' >&3
|
||||||
|
read -u4 line
|
||||||
|
while ! [[ $line = AtOM:NoMoreFiles ]]
|
||||||
|
do
|
||||||
|
copyfiles+=("$line")
|
||||||
|
read -u4 line
|
||||||
|
done
|
||||||
|
|
||||||
|
for copyfile in "${copyfiles[@]}"
|
||||||
|
do
|
||||||
|
sourcefilename=${copyfile%%|*}
|
||||||
|
rest="${copyfile#*|}|"
|
||||||
|
lastchange=${rest%%|*}
|
||||||
|
rest=${rest#*|}
|
||||||
|
destinationid=${rest%%|*}
|
||||||
|
rest=${rest#*|}
|
||||||
|
destfileid=${rest%%|*}
|
||||||
|
rest=${rest#*|}
|
||||||
|
echo 'SELECT IFNULL( (
|
||||||
|
SELECT destination_files.filename
|
||||||
|
FROM destination_files
|
||||||
|
INNER JOIN source_files
|
||||||
|
ON destination_files.source_file_id=source_files.id
|
||||||
|
INNER JOIN mime_type_actions
|
||||||
|
ON
|
||||||
|
mime_type_actions.id=source_files.mime_type
|
||||||
|
INNER JOIN destinations
|
||||||
|
ON destinations.id=destination_files.destination_id
|
||||||
|
WHERE destinations.id = '$destinationid'
|
||||||
|
AND source_files.filename LIKE "'"${sourcefilename%/*}"'/%"
|
||||||
|
AND mime_type_actions.action = 1
|
||||||
|
LIMIT 1
|
||||||
|
),"AtOM:NotFound");
|
||||||
|
'>&3
|
||||||
|
read -u4 filename
|
||||||
|
if [[ $filename != AtOM:NotFound ]]
|
||||||
|
then
|
||||||
|
destdir=${filename%/*}
|
||||||
|
if cp -al "$sourcepath/$sourcefilename" "$destdir" 2>/dev/null\
|
||||||
|
|| cp -a "$sourcepath/$sourcefilename" "$destdir"
|
||||||
|
then
|
||||||
|
Update destination_files \
|
||||||
|
filename "$destdir/${sourcefilename##*/}"\
|
||||||
|
rename_pattern "${destinationrenamepath[$destination]}/${destinationrename[$destination]}:${destinationfat32compat["$destination"]}"\
|
||||||
|
<<-EOWhere
|
||||||
|
id = $destfileid
|
||||||
|
last_change = $lastchange
|
||||||
|
EOWhere
|
||||||
|
progressSpin
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
copyFile() {
|
copyFiles_matching() {
|
||||||
extension="${filename##*.}"
|
extension="${filename##*.}"
|
||||||
cp -al \
|
cp -al \
|
||||||
"$sourcepath/$filename" \
|
"$sourcepath/$filename" \
|
||||||
Loading…
x
Reference in New Issue
Block a user