rename all *.js files containing React markup to *.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l "</" $0' {} \; -exec bash -c 'mv "$0" "${0%.js}.jsx"' {} \; |
Thanks!
Bravo!
@parties thanks for the snippet, worked great.
One suggestion, if using git, I changed mv
to git mv
.
find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l "</" $0' {} \; -exec bash -c 'git mv "$0" "${0%.js}.jsx"' {} \;
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for files that don't have
</
in them, you can run it with/>
as well