Advertisement
sergio_educacionit

files_type.sh

Feb 12th, 2025
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.40 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # ./files_type.sh /path/to/dir
  4.  
  5.  
  6. directory=$1
  7. # '%patron'  elimina el patron al final de la varible
  8.  
  9. directory_clean=${directory%/}
  10.  
  11. for file in $(ls -1 $directory_clean);do
  12.  
  13.  
  14.     # si el archivo es un directorio
  15.     # se ejecuta contine y se pasa ala siguiente
  16.     # itereacion
  17.     if [ -d ${directory_clean}/${file} ]; then
  18.  
  19.         continue
  20.     fi
  21.  
  22.     file ${directory_clean}/${file}
  23.  
  24.  
  25. done
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement