Skip to content

Instantly share code, notes, and snippets.

@seoutopico
Created August 4, 2023 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seoutopico/e25c3a20d9f3697501eedf03e0a71ea0 to your computer and use it in GitHub Desktop.
Save seoutopico/e25c3a20d9f3697501eedf03e0a71ea0 to your computer and use it in GitHub Desktop.
Script Python para renombrar imágenes eliminando acentos y reemplazando espacios por guiones
import os
import unidecode
# Cambiar al directorio que contiene las imágenes
os.chdir('D:\Descargas')
# Obtener todos los archivos en el directorio actual
files = os.listdir()
for file_name in files:
# Cambiar espacios por guiones y eliminar acentos
new_name = file_name.replace(' ', '-')
new_name = unidecode.unidecode(new_name)
# Cambiar el nombre del archivo
os.rename(file_name, new_name)
Unidecode==1.3.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment