Skip to content

Instantly share code, notes, and snippets.

@mustafaturan
Created July 8, 2017 14:18
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save mustafaturan/32df16bb4c49fbd837f777000f4b9aa2 to your computer and use it in GitHub Desktop.
Save mustafaturan/32df16bb4c49fbd837f777000f4b9aa2 to your computer and use it in GitHub Desktop.
Rename all js files into jsx
for x in *.js; do mv "$x" "${x%.js}.jsx"; done
@praveenperera
Copy link

rename all jsx to js

for x in src/**/*.jsx; do mv "$x" "${x%.jsx}.js"; done

@surajmandalcell
Copy link

surajmandalcell commented Sep 11, 2020

Rename all js to tsx including files inside sub-folders

for x in **/*.js; do mv "$x" "${x%.js}.jsx"; done

@jonmadison-amzn
Copy link

jonmadison-amzn commented Jul 30, 2021

Awesome, but don't drop that in as a replacement, kids, it omits "src" :)

for x in src/**/*.js; do mv "$x" "${x%.js}.jsx"; done

@ElieMuluke
Copy link

ElieMuluke commented Jun 2, 2023

On Windows, this PowerShell command can be used and saved in a .ps1 file

Get-ChildItem -Path "src" -Filter *.js -Recurse | Rename-Item -NewName {$_.Name -replace '.js$','.jsx' }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment