find
is a powerful tool that can not only find files but it can run a command on each matching file too. In this lesson, we’ll learn how to find all the images that match a pattern and run an image optimization tool on them.
FInd files:
find images/ -name "*.png" find images/ -iname "*.png" # case insensetive
Find folder:
find . -type d -name "images" # find folder named images
Doing deleting: '-delete'
find dist/ -name "*.built.js" -delete
Run command after finding the matching: '-exec'
find images/ -name "*.png" -exec pngquant {} ;