strip text from the middle of all filenames in a directory


/ Published in: Bash
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. for i in *.csv; do mv "$i" "${i/TEXTTOREMOVE/}"; done

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.