Bash: Remove Files with Regex

# example: all files like # my-filename-600x150.jpg # my-other_filename-1000x1530.jpg ls | grep -P "(.*)[1-9]{1}[0-9]{2,3}x[1-9]{1}[0-9]{2,3}.jpg" | xargs -d"\n" rm # ls -> list # grep -P "" -> Regex Filter # xargs -d"\n" -> List to string # rm -> remove
Example: Remove all thumbnails generated by WordPress

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.