#!/bin/sh # -*- mode: sh; fill-column: 75; tab-width: 8; coding: utf-8-unix -*- ROLE=base PREFIX=/usr/local prog=$( basename $0 .bash ) . /usr/local/bin/usr_local_tput.bash # accepted files or directories -- to recusively look for files in [ "$#" -eq 0 ] && set -- $PWD/ # Clean the bad ones under Windows: [:] and other uglies ['"{}[]?!] # The Bad ones break rsync and but the others can cause trouble elsewhere re='[^ .,~%+=^@!0-9a-zA-z_()#-]' find "$@" -type f -or -type d | while read file ; do dir=`dirname "$file"` base=`basename "$file"` # wierd = misses "ZeeRex The Explainable ``Explain__ Service.htm" new=`sed -f $PREFIX/share/sed/base_clean_filenames.sed <<< $base` [ "$base" = "$new" ] && continue [ -f "$file" -a -f "$dir/$new" ] && diff -qr "$file" "$dir/$new" && rm -f "$file" && continue DBUG \"$file\" \"$dir/$new\" mv -i "$file" "$dir/$new" done exit 0