(You can choose or or both)

Monday, October 30, 2006

Windows Rename Multiple Files

J'ai cherché ça sur le web, et je n'ai trouvé que des trucs payants à télécharger. Alors voilà comment faire :
  • Ouvrir bloc-notes
  • Copier-coller le texte suivant dedans
  • Sauvegarder le fichier dans le répertoire où vous voulez renommer des fichiers
  • Double-cliquez dessus et suivez les instructions
Sans aucune garantie, et sans possibilité de revenir en arrière.

I did a quick search with Google and only came up with things that had to be paid for, so here's the quick and dirty way:
  • Open notepad
  • Copy and paste the following code
  • Save the file in the folder where you want to do the renaming
  • Double click on the file and follow the instructions
No guarantee, and no undo button.

'--- Rename multiple files in the folder where this script is placed---
find = inputBox("Please insert text to replace")
repl = inputBox("Please insert replacement text")
pth = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, "\"))

ans = msgbox("Replace '" & find & "' with '" & repl & "' in all file names?", vbYesNoCancel+vbQuestion)
if ans <> vbYes then wscript.quit

cnt=0

set fso = CreateObject("Scripting.FileSystemobject")
set fils = fso.GetFolder(pth).Files
for each fil in fils
if instr(fil.name, find) > 0 then
cnt = cnt + 1
Call fso.MoveFile (fil.name, Replace(fil.name, find, repl))
end if
next

msgbox "Done rename " & cnt & " files."
'--- End of script ----

1 comment yet :

Anonymous said...

Hey! Can we have baby pictures back please? All this nerdy stuff is giving me a headache!
My objection to all these enhancements is that they make the program ever bigger and more complex. I mean, look at Adobe Reader! It takes far longer to open a file than in Word. It used to be an instantaneous process, and now every time I use it I have to fight off a predatory bid to add yet more junk.