Home > posts > Bulk Rename – Replace Space with Underscore

Bulk Rename – Replace Space with Underscore

August 26th, 2009 subogero

A small script to perform bulk renaming of files, replacing spaces with underscores and exotic letters with sanitized versions.

Save this link as /usr/bin/s2u.

#!/bin/sh
ls -1 | while read -r FILE; do
  mv -v "$FILE" `echo $FILE | tr ' áéíóöïúü' '_aeiooouu'`;
done
Categories: posts Tags: , , ,
Comments are closed.