Skip to content

Instantly share code, notes, and snippets.

@CodeArtha
Created July 21, 2019 00:30
Show Gist options
  • Select an option

  • Save CodeArtha/27729c023986908c625cf80edecb4084 to your computer and use it in GitHub Desktop.

Select an option

Save CodeArtha/27729c023986908c625cf80edecb4084 to your computer and use it in GitHub Desktop.
Bash script to change all files with one extension in a folder to another
#!/bin/bash
from_ext=".txt"
to_ext=".csv"
for file in *$from_ext; do mv "$file" "$(basename "$file" $from_ext)$to_ext"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment