Tinha uma nomenclatura ranhosa nuns ficheiros que têm uma data no nome o que provocava uma grande confusão em termos de ordenamento. Abri a consola e voilá :)


import os

for file in os.listdir("."):
if file.startswith("report"):
if not file[7].isdigit():
os.rename(file,”report0″+file[8:])

for file in os.listdir(”.”):
if file.startswith(”report”):
os.rename(file,”report”+file[11:13]+file[8:11]+file[6:8]+
file[13:])

P.S.: Eu até indentava isto em condições mas a maneira como o Wordpress trata (ou não trata) os espaços em branco é odiosa. Detesto este editor… Chamar a isto WYSIWYG é brincadeira certamente. Quando muito é WYSIWWW - What you see is what we want ou WYSIWYGBPDUWS - What you see is what you get, but please don’t use white spaces. O mais correcto mesmo é WYSIWYGBOAYCTSBAWTIWBDFWYWS - what you see is what you get but only after you click the Save button, at which time it will become different from what you were seeing

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="">