Guest User

Untitled

a guest
Jan 21st, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. BACKUP_PARENT=$HOME/.config/vivaldi/viv_session
  2. BACKUP_LAST=$(find "$BACKUP_PARENT" -type d | sort -h | tail -n 1)
  3.  
  4. VIVDIR=$HOME/.config/vivaldi/Default
  5.  
  6. diff "$BACKUP_LAST/Current Session" "$VIVDIR/Current Session" > /dev/null 2>&1
  7. if [ $? -eq 0 ]; then
  8. #echo "no change"
  9. exit 0;
  10. fi
  11.  
  12. TMPDIR=$BACKUP_PARENT/$(date "+%Y%m%d_%H%M%S")
  13. #echo $TMPDIR
  14. mkdir -p "$TMPDIR"
  15.  
  16. cp -p "$VIVDIR"/Last\ * "$VIVDIR"/Current\ * "$TMPDIR"
  17.  
  18. #prune old dirs
  19. find "$BACKUP_PARENT" -mindepth 1 -maxdepth 1 -type d | sort -h | head -n -10 | xargs rm -rf
Add Comment
Please, Sign In to add comment