1
0
mirror of https://github.com/pgrondek/config.git synced 2024-11-21 19:43:42 +00:00

Update sanitaze-folder

This commit is contained in:
Przemysław Grondek 2020-03-04 14:47:54 +01:00
parent ccfc5a8676
commit 4d3fcf3d37

View File

@ -1,6 +1,11 @@
#!/bin/bash
if [ -d "${HOME}/Pobrane" ]
#set -x
set -e
shopt -s dotglob nullglob
if [[ -d "${HOME}/Pobrane" && ! -L "${HOME}/Pobrane" ]]
then
mkdir -p "${HOME}/Downloads"
mv ${HOME}/Pobrane/* "${HOME}/Downloads"
@ -9,7 +14,7 @@ then
ln -s "${HOME}/Downloads" "${HOME}/Pobrane"
echo "Symlinked ${HOME}/Pobrane to ${HOME}/Downloads"
else
if [ -L "${HOME}/Pobrane" ]
if [[ -L "${HOME}/Pobrane" ]]
then
echo "Nothing to do ${HOME}/Pobrane is already symlink"
else
@ -17,3 +22,21 @@ else
echo "Symlinked ${HOME}/Pobrane to ${HOME}/Downloads"
fi
fi
if [[ -d "${HOME}/Dokumenty" && ! -L "${HOME}/Dokumenty" ]]
then
mkdir -p "${HOME}/Documents"
mv ${HOME}/Dokumenty/* "${HOME}/Documents" || true
echo "Moved all download srom ${HOME}/Dokumenty to ${HOME}/Documents"
rmdir "${HOME}/Dokumenty"
ln -s "${HOME}/Documents" "${HOME}/Dokumenty"
echo "Symlinked ${HOME}/Dokumenty to ${HOME}/Documents"
else
if [[ -L "${HOME}/Dokumenty" ]]
then
echo "Nothing to do ${HOME}/Dokumenty is already symlink"
else
ln -s "${HOME}/Documents" "${HOME}/Dokumenty"
echo "Symlinked ${HOME}/Dokumenty to ${HOME}/Documents"
fi
fi