Replace a substring in source file names

For example, the command below

find -name "*android*" -exec rename 's/android/windows/' {} \;

renames the following source files:

androidinappproduct.cpp
androidinappproduct.h
androidinapppurchasebackend.cpp
androidinapppurchasebackend.h
androidinapptransaction.cpp
androidinapptransaction.h

with

windowsinappproduct.cpp
windowsinappproduct.h
windowsinapppurchasebackend.cpp
windowsinapppurchasebackend.h
windowsinapptransaction.cpp
windowsinapptransaction.h

Another example is renaming android resources:

find -name "*-sw*" -exec rename 's/-sw/-w/' {} \;
find -name "values-sw*dp" -exec rename 's/dp/px/' {} \;

Leave a Reply

Your email address will not be published. Required fields are marked *