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 #!/bin/bash
if [ -d "${HOME}/Pobrane" ] #set -x
set -e
shopt -s dotglob nullglob
if [[ -d "${HOME}/Pobrane" && ! -L "${HOME}/Pobrane" ]]
then then
mkdir -p "${HOME}/Downloads" mkdir -p "${HOME}/Downloads"
mv ${HOME}/Pobrane/* "${HOME}/Downloads" mv ${HOME}/Pobrane/* "${HOME}/Downloads"
@ -9,7 +14,7 @@ then
ln -s "${HOME}/Downloads" "${HOME}/Pobrane" ln -s "${HOME}/Downloads" "${HOME}/Pobrane"
echo "Symlinked ${HOME}/Pobrane to ${HOME}/Downloads" echo "Symlinked ${HOME}/Pobrane to ${HOME}/Downloads"
else else
if [ -L "${HOME}/Pobrane" ] if [[ -L "${HOME}/Pobrane" ]]
then then
echo "Nothing to do ${HOME}/Pobrane is already symlink" echo "Nothing to do ${HOME}/Pobrane is already symlink"
else else
@ -17,3 +22,21 @@ else
echo "Symlinked ${HOME}/Pobrane to ${HOME}/Downloads" echo "Symlinked ${HOME}/Pobrane to ${HOME}/Downloads"
fi fi
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