21 lines
379 B
Bash
Executable File
21 lines
379 B
Bash
Executable File
#!/bin/sh
|
|
|
|
tmpd="$(mktemp -d)"
|
|
|
|
for file in .config/*; do
|
|
[ ! -e "$HOME/$file" ] || mv "$HOME/$file" "$tmpd"
|
|
done
|
|
|
|
if rmdir "$tmpd" 2>/dev/null; then
|
|
echo "Nothing to archive"
|
|
else
|
|
name="existing-$(date +"%Y%m%d_%H%M%S").tar.gz"
|
|
if tar czvf "$name" "$tmpd"; then
|
|
rm -rf "$tmpd"
|
|
echo "$name created"
|
|
else
|
|
echo "Archive could not be created. See $tmpd."
|
|
exit 1
|
|
fi
|
|
fi
|