0

I'm trying out the code that answers this questions:

How do I change the extension of multiple files?

I tried this:

# Rename all *.js to *.ts
for f in *.js; do 
    mv -- "$f" "${f%.js}.ts"
done

However that results in this:

Oles-MacBook-Pro:src oleersoy$ ./rename.sh 
mv: rename *.js to *.ts: No such file or directory

I also tried this:

rename js ts *.js

And the result of that is:

Bareword "js" not allowed while "strict subs" in use at (eval 2) line 1.

Thoughts?

Ole
  • 707

1 Answers1

0

OK - found this on SO:

https://stackoverflow.com/questions/21985492/recursively-change-file-extensions-in-bash

And this works:

find . -name "*.t1" -exec rename 's/\.t1$/.t2/' '{}' +
Ole
  • 707