Tuesday, January 20, 2015

macos - How do I rename all items in files in folder in folder in folder?

I'm using a MacOS X. I know that this code in the terminal will replace all txt files that include "hello" with "hiThere" in the folder named "world":


perl -pi -w -e 's/hello/hiThere/g;' ~/Desktop/world/*.txt

But inside that world folder there are other folders which have other txt files in them, and those don't go through the refactor or the rename, you have to then individually type the additional folders using the above method.


Is there a method that does it automatically for you?

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...