Add merge_add_databases.sh script
This commit is contained in:
Knyffen 2022-01-31 13:40:58 +01:00
parent b85d16eb6b
commit 50827375ac
14 changed files with 48 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

48
merge_all_databases.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
# Read Password
echo -n "Password: "
read -s PASSWORD
echo
FILES=$(find . -name '*.kdbx' -print)
MERGES=$(echo "$FILES" | wc -l)
COUNT=0
GLOBAL='./Database - global.kdbx';
IFS=$'\n'
MERGES=$((MERGES*2-2))
# Merge all to global
for FILE in $FILES
do
if [ "$FILE" != "$GLOBAL" ];
then
echo "$FILE"
echo $PASSWORD | keepassxc-cli merge -q -s "$GLOBAL" "$FILE" 2> /dev/null
echo -ne $((++COUNT))"/$MERGES"\\r
fi
done
# Merge all from global
for FILE in $FILES
do
if [ "$FILE" != "$GLOBAL" ];
then
echo "$FILE"
echo $PASSWORD | keepassxc-cli merge -q -s "$FILE" "$GLOBAL" 2> /dev/null
echo -ne $((++COUNT))"/$MERGES"\\r
fi
done
# Merge all to all
#MERGES=$(($MERGES**2-$MERGES))
#for FILE1 in $FILES
#do
# for FILE2 in $FILES
# do
# if [ "$FILE1" != "$FILE2" ];
# then
# echo $PASSWORD | keepassxc-cli merge -q -s "$FILE1" "$FILE2" 2> /dev/null
# echo -ne $((++COUNT))"/$MERGES"\\r
# fi
# done
#done
echo;