-
-
Save afternoon/9022899 to your computer and use it in GitHub Desktop.
find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \; |
Handy, but if you are using files in version control use:
find src -name "*.js" -exec sh -c 'git mv "$0" "${0%.js}.ts"' {} \;
Beautiful!
great!
thanks, works perfectly.
FYI: If you want to change jsx to tsx also, the command would become as follows
find app/src -name "*.jsx" -exec sh -c 'mv "$0" "${0%.jsx}.tsx"' {} \;
Thanks!
How to rename .ts to .js?
Nice!
I needed to pre-filter to only certain folders using globs:
find **/background/**/*.js -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
Run a test first with just the find:
find **/background/**/*.js
Thanks a lot!
Thanks!
Thank you !
Just what i needed
This one works, thanks!
This is great. How could I make it so it will only change .js files that begin with capital letters or follow a certain regex pattern?
Thanks!
thanks!
Thanks!
find . -path ./node_modules -prune -o -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
if your sources are in ./ and you must skip node_modules
I had to do
find app/src -name "*.js" -exec sh -c 'mv "${0}" "${0/js/ts}"' {} \;
Thank you very much indeed!
+1, Thanks mate!
+1, Thanks
nice
Worked a charm, thanks
Thanks!
Thank you!
Thanks!
thanks my man
Thank you kindly