0

In bash I can do find . -name jndi.properties -exec rename 's/jndi/environment/' {} \; to recursively find all jndi.propertie files and have them renamed to environment.properties.

But git status does not recognize the mv, it shows the deletion and addition separately. How can I do recursive git mv?

dr jerry
  • 9,768
  • 24
  • 79
  • 122

1 Answers1

2

Since you're doing an exact match on the name, you don't really need to do a dynamic substitution, do you? If your find supports it (BSD and GNU do, but it's not specified in POSIX) you could use -execdir to execute the command in the directory so you could just do

find . -name jndi.properties -execdir git mv {} environment.properties \;
Eric Renouf
  • 13,950
  • 3
  • 45
  • 67