Monday, August 27, 2012

How to rename multiple files on Linux

Sometimes we need to make something with tons of files. Just imagine you need either to remove white space or  another char from 999 file names in some folder. Actually it isn't a manual task. Below the bash script that can help:

#!/bin/bash
d="/tmp/folder_with_files" 
find "$d" -type f | while read F; do N=`echo $F|sed -n 's/\s//gp';`; mv -v "$F" $N; done



No comments:

Post a Comment