AtOM/lib/copy/guessPath
2013-05-25 15:35:04 +02:00

29 lines
650 B
Bash

#!/bin/bash
guessPath() {
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
"'"${sourcedir//\"/\"\"}"'/%"
AND mime_type_actions.action = 1
LIMIT 1
),"AtOM:NotFound");
'>&3
read -u4 filename
if [[ $filename != AtOM:NotFound ]]
then
echo "${filename%/*}"
else
return 1
fi
}