Skip to content

Instantly share code, notes, and snippets.

@olmosleo
Created March 19, 2021 22:03
Show Gist options
  • Save olmosleo/f09aee4ef0148134bee200dd620205d4 to your computer and use it in GitHub Desktop.
Save olmosleo/f09aee4ef0148134bee200dd620205d4 to your computer and use it in GitHub Desktop.
Dos procedimientos para recorrer archivos en Linux y obtiene el tamaño de cada file en una salida
#!/bin/bash
while IFS= read -r line
do
ls -Ral /var/www/$line | awk '{t+=$5}END{print t}' >> output_file_size.txt
done < lista_files.txt
##!/bin/bash
#while IFS= read -r line
#do
# du -h /var/www/$line >> output_file_size_mb.txt
#done < lista_files.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment