How to rename everything matching a certain string in a folder

Posted by lostiniceland on Server Fault See other posts from Server Fault or by lostiniceland
Published on 2010-05-19T21:38:07Z Indexed on 2010/05/19 21:40 UTC
Read the original article Hit count: 262

Filed under:
|
|
|

Hello Everyone

I am running Linux and I have some basic console knowledge but my current problem is quite difficult and I dont know how to achieve this.

I want/need to rename everything within a folder that matches a given string. By everything I mean

  • folders/files
  • content within a file
  • content in hidden files

Basically I want to refactor a Java-project. Sure, I could use Eclipse to handle the replacing, but this leaves out the folders or resources outside of my workspace.

I was thinking of a script that could do the job for me but this seems rather tricky. For instance when it comes to folder-/file-rename I want to replace only the part of the name that matches my string, the rest should remain untouched.

Maybe someone already has something like this in his/her script-collection :-)

Thanks in advance

Marc

© Server Fault or respective owner

Related posts about linux

Related posts about command-line