I have a directory with files like this
a.JPG
b.JPG
c.JPG
I would like to perform something like this
git mv a.JPG a.jpg
I tried using xargs and other tools but nothing seems to work.
To rename file extensions from .JPG to lowercase. This uses git mv
, so that git history is preserved.
find . -name "*.JPG" | xargs -L1 bash -c 'git mv $0 ${0/JPG/jpg}'
Whether or not you can just change the case of the file will depend on your filesystem. Even if it works on your filesystem, you could cause problems for other people updating. You'll be best renaming them, committing them, then renaming them back. Change everything to *.tmp with the following bash script:
for i in *.JPG; do mv $i ${i%.JPG}.tmp; done
Then move them all in git. You can use a similar command, but I would recommend checking out guess-renames which will help with the move.
Then rename them all back to *.jpg with a similar process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With