Skip to content

Instantly share code, notes, and snippets.

@2KAbhishek
Created October 26, 2020 08:53
Show Gist options
  • Save 2KAbhishek/ab3bd7af42dd2a902edd96a3e052c5bb to your computer and use it in GitHub Desktop.
Save 2KAbhishek/ab3bd7af42dd2a902edd96a3e052c5bb to your computer and use it in GitHub Desktop.
Batch rename extensions of files
#!/bin/bash
# Rename all *.txt to *.text
for f in *.txt; do
mv -- "$f" "${f%.txt}.text"
done
#!/bin/zsh
# Load zmv module
autoload -U zmv
# Rename all *.txt to *.text
zmv '(*).txt' '$1.text'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment