Skip to content

Instantly share code, notes, and snippets.

@leyanlo
Last active August 30, 2018 00:08
Show Gist options
  • Save leyanlo/f1ed5ae03b9ae2364c4ce42240ca9e88 to your computer and use it in GitHub Desktop.
Save leyanlo/f1ed5ae03b9ae2364c4ce42240ca9e88 to your computer and use it in GitHub Desktop.
Script to convert camelCase filenames to snake_case
#!/bin/bash
# Recurse through subdirectories and convert camelCase filenames to snake_case
for file in */**/*.* ; do
mv "$file" "$(echo $file|gsed -e 's/\([A-Z]\)/_\1/g' -e 's/^.\/_//'|awk '{print tolower($0)}')"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment