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


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.