Skip to content

Instantly share code, notes, and snippets.

@wendelnascimento
Created October 22, 2020 20:34
Show Gist options
  • Save wendelnascimento/9f07dfaae7e89a3efac2752be73ab848 to your computer and use it in GitHub Desktop.
Save wendelnascimento/9f07dfaae7e89a3efac2752be73ab848 to your computer and use it in GitHub Desktop.
Rename all files in directory sequentially (preserving file original extension)
ls | cat -n | while read n f; do mv "$f" "new name${n}_new name$n.${f##*.}"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment