RSS Amplifier

Home | BackEndTea · Aug 5, 2024

Change extensions of all files in a folder

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

This week I wanted to change all the .js files to .ts recursively in a folder. To change all .js files in the assets folder. With a bit of bash, using a for loop and mv I got the following command to rename all my .js to .ts files. for f in assets/*.js ; do mv -- ' $f ' ' ${ f %.js } .ts' ; done If you want to get notified of the next blog post, join the newsletter.

This week I wanted to change all the .js files to .ts recursively in a folder.

To change all .js files in the assets folder. With a bit of bash, using a for loop and mv I got the following command to rename all my .js to .ts files.

for f in assets/*.js; do mv -- "$f" "${f%.js}.ts"; done

If you want to get notified of the next blog post, join the newsletter.

Read on backendtea.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.