Skip to content

Instantly share code, notes, and snippets.

@martindrapeau
Created August 29, 2014 03:01
Show Gist options
  • Select an option

  • Save martindrapeau/561616cf5b5ed9fc58a6 to your computer and use it in GitHub Desktop.

Select an option

Save martindrapeau/561616cf5b5ed9fc58a6 to your computer and use it in GitHub Desktop.
Rename files replacing non ASCII by _
find /path/to/files -type f -print0 | \
perl -n0e '$new = $_; if($new =~ s/[^[:ascii:]]/_/g) {
print("Renaming $_ to $new\n"); rename($_, $new);
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment