Skip to content

Instantly share code, notes, and snippets.

@glynhudson
glynhudson / renamespace.sh
Created January 31, 2017 20:23
Bash script to rename file names in a folder to remove spaces and special characters, used when importing photos into Piwigo
#!/bin/bash
# Convert filenames to lowercase
# and replace characters recursively
#####################################
if [ -z $1 ];then echo Give target directory; exit 0;fi
find "$1" -depth -name '*' | while read file ; do
directory=$(dirname "$file")
oldfilename=$(basename "$file")