Advertisement
sergio_educacionit

backup-v2.sh

Sep 21st, 2022 (edited)
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.48 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Declaracion de variables
  4.  
  5. fecha="$(date +%Y-%m-%d_%H-%M)"
  6. dest="/tmp"
  7.  
  8.  
  9.  
  10.  
  11. # Creación directorio.
  12.  
  13. mkdir $dest/${USER}-$fecha
  14.  
  15. # Buscar y copiar ficheros de mas de 10 MB al directorio creado en el paso anterior.
  16.  
  17. find ./ -type f -size +10M -exec cp {} $dest/${USER}-$fecha \;
  18.  
  19.  
  20. # información de salida
  21.  
  22. echo "Backup terminado el $(date), archivos copiados en '$dest/${USER}-$fecha':"
  23.  
  24. du -h $dest/${USER}-$fecha
  25. echo ""
  26. ls $dest/${USER}-$fecha
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement