Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@idkjs
Last active August 30, 2021 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idkjs/dadc6eb017a59782a2310f0a7cd4dfba to your computer and use it in GitHub Desktop.
Save idkjs/dadc6eb017a59782a2310f0a7cd4dfba to your computer and use it in GitHub Desktop.
rename extensions
#!/bin/bash
echo "Enter the target directory "
read -r target_dir
cd "$target_dir" || exit
echo "Enter the file extension to search without a dot"
read -r old_ext
echo "Enter the new file extension to rename to without a dot"
read -r new_ext
echo "$target_dir, $old_ext, $new_ext"
for file in *.$old_ext
do
mv -v "$file" "${file%.$old_ext}.$new_ext"
done;
https://linuxhint.com/change-file-extension-multiple-files-bash/
Or
```sh
find . -iname '*.res' | sed 'p;s/\.res/\.re/' | xargs -n2 mv
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment