I'm trying rename all files which start for a specific word. This works for me if I write the entire name, but not if I put *. I don't find the correct syntax. Any suggestions? Thank you!
os.rename("C:/Users/myname/Downloads/Reference*.xlsx", "C:/Users/myname/Downloads/" + " " + "Lote" + ".xlsx")
I don't know if I need put the "*" in other part.
Old name: files wich start by Reference word. New name for this files: "Lote"
Thank you.
I'm trying with this, but I don't find the solution:
import glob
import os
identificador = 0
ruta_carpeta = 'C:/Users/myname/Downloads'
lista_archivos = sorted(glob.glob(ruta_carpeta + 'Reference/*.xlsx'))
for i in lista_archivos:
nuevo_nombre = ruta_carpeta + '/' + "Lote" + '.xlsx'
os.rename(i, nuevo_nombre)