Posted By

powerthru on 10/11/10


Tagged

Shell directory filename rename


Versions (?)

strip text from the middle of all filenames in a directory


 / Published in: Bash
 

URL: http://www.debian-administration.org/articles/150

Expects all files to be in the current directory; does not recurse into subdirectories. Replace "TEXTTOREMOVE" with the text you wish to remove from the filename. Replace *.csv with a search term appropriate for your situation.

  1. for i in *.csv; do mv "$i" "${i/TEXTTOREMOVE/}"; done

Report this snippet  

You need to login to post a comment.