Posted By

iblis on 01/08/08


files perl rename admnistration

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Batch rename files in directory

 / Published in: Bash

test with echo instead of mv example removes spaces after dots, replaces spaces with _, removes ' , and -, and finally lowercases filenames

  1. for F in * ; do NF=`echo $F | perl -lne "s/ /_/g; s/\._/./g; s/[',-]//g; print lc"` ; mv "$F" "$NF" ; done

Report this snippet  


RSS Icon Subscribe to comments
Posted By: jkramer on January 30, 2008

ZSH: for foo in *; mv "$foo" "${${(L)${foo//[,'-]/}//. ##/.}// /_}"

You need to login to post a comment.