Wednesday, April 29, 2009

Rename all files in one folder

This is a little tip for you, and a remider for me :P
bash $ for i in *;do mv $i `echo $i | sed 's/pattern/newpattern/'`; done

4 comments:

  1. Now, try to do this on windows command prompt... or on Windows Explorer.. LOLOL.. And people still ask why do I think windows sucks... LOLOL

    ReplyDelete
  2. Actually, I think that in windows exists something like "rename" but I'm not sure.

    ReplyDelete
  3. Yes, windows has the rename command, but that wasn't what i was refering to.
    Windows RENAME syntax is: "RENAME [drive:][path]filename1 filename2". This doesn't help very much. Ok, you could try to "push" some batch code just like you did with the bash code, but still you wouldn't go very far... Know what I mean?

    ReplyDelete
  4. Maybe you could use the wonderful features of the new powershell.

    ReplyDelete