Search This Blog

2015-03-26

Batch Rename Files With Sed

To rename files we get a list of files, match a patern, and copy to a destination with that new regex filename

Validate Functionality

for i in `ls /path/to/files/`; do echo $i | sed "s/winxp/windows/"; done


Commit Changes

for i in `ls /path/to/files/ | grep winxp`; do cp /path/to/files/$i `echo /path/to/files/$i | sed "s/winxp/windows/"`; done


References:
http://tosbourn.com/copy-rename-multiple-files-linux/
http://www.minihowtos.net/copy-and-rename-multiple-files

No comments:

Post a Comment