Deleting files that contain a pattern

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

-l grep options shows the path and only the path of the matching file

Copy this code and paste it in your HTML
  1. for i in `grep -rl "PATTERN" $DIR`; do rm -f $i; done;

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.