Posted By

zitter on 11/22/10


Tagged

Bash


Versions (?)

Remove cap and space from filename using bash


 / Published in: Bash
 

URL: http://www.linuxquestions.org/questions/programming-9/bash-script-to-remove-capitalisation-and-spaces-form-a-filename-309567/

  1. for f in *; do
  2. file=$(echo $f | tr A-Z a-z | tr ' ' _)
  3. [ ! -f $file ] && mv "$f" $file
  4. done

Report this snippet  

You need to login to post a comment.