clear
kalladir=home/hynt
backupdir=media/hynt/EXTERN/backup
now=$(date +"%m_%d_%Y")
#Om mappen inte finns skapa den, detta är för slippa gnället om att mappen redan finns
[ ! -d /$backupdir/$now/ ] && mkdir -p /$backupdir/$now/
[ ! -d /$backupdir/$now/Hämtningar/ ] && mkdir -p /$backupdir/$now/Hämtningar/
[ ! -d /$backupdir/$now/Dokument/ ] && mkdir -p /$backupdir/$now/Dokument/
[ ! -d /$backupdir/$now/Bilder/ ] && mkdir -p /$backupdir/$now/Bilder/
[ ! -d /$backupdir/$now/Musik/ ] && mkdir -p /$backupdir/$now/Musik/
[ ! -d /$backupdir/$now/PDF/ ] && mkdir -p /$backupdir/$now/PDF/
[ ! -d /$backupdir/$now/Projekt/ ] && mkdir -p /$backupdir/$now/Projekt/
[ ! -d /$backupdir/$now/Skrivbord/ ] && mkdir -p /$backupdir/$now/Skrivbord/
[ ! -d /$backupdir/$now/archives/ ] && mkdir -p /$backupdir/$now/archives/
[ ! -d /$backupdir/$now/tmp/ ] && mkdir -p /$backupdir/$now/tmp/
[ ! -d /$backupdir/$now/.mozilla/ ] && mkdir -p /$backupdir/$now/.mozilla/
[ ! -d /$backupdir/$now/.thunderbird/ ] && mkdir -p /$backupdir/$now/.thunderbird/
[ ! -d /$backupdir/$now/archives/ ] && mkdir -p /$backupdir/$now/archives/
[ ! -d /$backupdir/$now/packages/ ] && mkdir -p /$backupdir/$now/packages/
echo "---------------------------------------------"
echo "From: /$kalladir/"
echo "To: /$backupdir/$now/"
echo "---------------------------------------------"
echo "Backup Folder: Bilder" && sudo cp -R -n /$kalladir/Bilder/ /$backupdir/$now/
echo "Backup Folder: Dokument" && sudo cp -R -n /$kalladir/Dokument/ /$backupdir/$now/
echo "Backup Folder: Hämtningar" && sudo cp -R -n /$kalladir/Hämtningar/ /$backupdir/$now/
echo "Backup Folder: Musik" && sudo cp -R -n /$kalladir/Musik/ /$backupdir/$now/
echo "Backup Folder: PDF" && sudo cp -R -n /$kalladir/PDF/ /$backupdir/$now/
echo "Backup Folder: Projekt" && sudo cp -R -n /$kalladir/Projekt/ /$backupdir/$now/
echo "Backup Folder: Skrivbord" && sudo cp -R -n /$kalladir/Skrivbord/ /$backupdir/$now/
echo "Backup Folder: tmp" && sudo cp -R -n /$kalladir/tmp/ /$backupdir/$now/
echo "Backup Folder: Video" && sudo cp -R -n /$kalladir/Video/ /$backupdir/$now/
echo "Backup Folder: .mozilla" && sudo cp -R -n /$kalladir/.mozilla/ /$backupdir/$now/
echo "Backup Folder: .thunderbird" && sudo cp -R -n /$kalladir/.thunderbird/ /$backupdir/$now/
echo "Backup File: .bash_aliases" && sudo cp -R -n /$kalladir/.bash_aliases /$backupdir/$now/
echo "Backup File: .bashrc " && sudo cp -R -n /$kalladir/.bashrc /$backupdir/$now/
echo "Backup Folder: .archives" && sudo cp -R -n /var/cache/apt/archives/*.deb /$backupdir/$now/archives/
cd /$backupdir/$now/
sudo dpkg --get-selections > /$backupdir/$now/packages/Package.list
sudo cp -R /etc/apt/ /$backupdir/$now/packages/
sudo apt-key exportall > /$backupdir/$now/packages/Repo.keys
Inga kommentarer:
Skicka en kommentar