Created
October 22, 2023 23:00
-
-
Save guillorrr/2561fb5ee8db52c82ea9a9a2ba4a586a to your computer and use it in GitHub Desktop.
Bash scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Leer los archivos de listado a.txt y b.txt en dos arrays | |
| mapfile -t listado_a < old.txt | |
| mapfile -t listado_b < new.txt | |
| # Verificar si los tamaños de los listados son iguales | |
| if [ ${#listado_a[@]} -ne ${#listado_b[@]} ]; then | |
| echo "Los tamaños de los listados no coinciden." | |
| exit 1 | |
| fi | |
| # Renombrar los videos en base a los listados | |
| for ((i=0; i<${#listado_a[@]}; i++)); do | |
| old_name="${listado_a[i]}" | |
| new_name="${listado_b[i]}" | |
| mv "$old_name" "$new_name" | |
| echo "Archivo $old_name renombrado como $new_name" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment