Skip to content

Instantly share code, notes, and snippets.

@AgustinParmisano
Last active November 5, 2024 23:21
Show Gist options
  • Save AgustinParmisano/ff85752c5c74eb203f9e1a9a879fc7de to your computer and use it in GitHub Desktop.
Save AgustinParmisano/ff85752c5c74eb203f9e1a9a879fc7de to your computer and use it in GitHub Desktop.
tp final sistemas operativos 2024 isfdyt210
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Se requieren 2 parametros: {string} {directorio}"
exit 2
fi
peso=$(ls -l $2 | grep "$1" | awk -F' ' '{sum+=$5;} END{print sum;}')
cant=$(ls -l | tail -n +2 | grep -c t)
ext=$(ls -l | grep $1 | awk -F"." '{ print $2 }' | sort | uniq -c | sort | tail -1)
echo "Cantidad de archivos encontrados: $cant"
echo "Peso total de los archivos: $peso"
echo "Formato más común: $ext"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment