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 {} \; 

[Bash] Find Files and Folders with `find` in Bash的更多相关文章

  1. [Bash] View Files and Folders in Bash

    Sometimes when working at the command line, it can be handy to view a file’s contents right in the t ...

  2. Mac OS finder : 显示和隐藏文件[夹] show and hide files or folders

    Finder默认是不显示隐藏文件[夹]的,要显示出怎么办? 要显示的话,可以GUI(graphic user interface)和CLI(command line interface)两种方式 CL ...

  3. Track files and folders manipulation in Windows

    The scenario is about Business Secret and our client do worry about data leakage. They want to know ...

  4. Bash: about .bashrc, .bash_profile, .profile, /etc/profile, etc/bash.bashrc and others

    Some interesting excerpts from the bash manpage:When bash is invoked as an interactive login shell, ...

  5. [Bash] Move and Copy Files and Folders with Bash

    In this lesson we’ll learn how to move and rename files (mv) and copy (cp) them. Move index.html to ...

  6. [转]COPY OR MOVE FILES AND FOLDERS USING OLE AUTOMATION

    本文转自:http://sqlindia.com/copy-move-files-folders-using-ole-automation-sql-server/ I love playing aro ...

  7. bash guide

    Table of Contents Basic Operations 1.1. File Operations 1.2. Text Operations 1.3. Directory Operatio ...

  8. linux shell & bash

    shell & bash shell指允许用户通过文本操作计算机的程序. interactive shell:从是否通过标准输入输出与用户进行交互的角度分为交互式shell(interacti ...

  9. powershell与linux bash对比

    转自Github/Powershell Bash PowerShell Description ls dir, Get-ChildItem List files and folders tree di ...

随机推荐

  1. JS 中的事件绑定、事件监听、事件委托是什么?

    在JavaScript的学习中,我们经常会遇到JavaScript的事件机制,例如,事件绑定.事件监听.事件委托(事件代理)等.这些名词是什么意思呢,有什么作用呢? 事件绑定 要想让 JavaScri ...

  2. nginx 的编译安装及基本操作

    下载nginx [root@nginx ~]# wget http://nginx.org/download/nginx-1.14.0.tar.gz --2019-05-02 21:52:23-- h ...

  3. Xgboost集成算法

    集成算法思想: Xgboost基本原理: Xboost中是一个树(函数)接着一个树(函数)往里加,每加一个树都希望整体表达效果更好一些,即:目标函数逐步减小. 每加入一个函数,使目标函数逐渐减小,整体 ...

  4. JavaScript/JQuery radioButton(单选按钮)练习20190409

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  5. vmware linux虚拟机与本地物理机共享文件夹

    cd /mnt/hgfs 使用Vmware安装了linux虚拟机后,开发时,为了方便文件的传输等,因此需要使用共享文件夹,减少工作量.共享文件夹需要用到vmware提供的vmware tools工具, ...

  6. ping ip

    def ip_and_time(): """ get ip to ping from ip.txt then return two list , each ip that ...

  7. 【收藏】史上最全的浏览器 CSS & JS Hack 手册

    浏览器渲染页面的方式各不相同,甚至同一浏览器的不同版本(“杰出代表”是 IE)也有差异.因此,浏览器兼容成为前端开发人员的必备技能.如果有一份浏览器 Hack 手册,那查询起来就方便多了.这篇文章就向 ...

  8. Swift语言Storyboard教程:第二部

    本文由CocoaChina翻译小组@TurtleFromMars翻译自raywenderlich,原文:Storyboards Tutorial in Swift: Part 2 更新记录:该Stor ...

  9. 最小生成树 Prim算法 Kruskal算法实现

    最小生成树定义 最小生成树是一副连通加权无向图中一棵权值最小的生成树. 在一给定的无向图 G = (V, E) 中,(u, v) 代表连接顶点 u 与顶点 v 的边(即,而 w(u, v) 代表此边的 ...

  10. HDU-5253-链接的管道

    http://acm.hdu.edu.cn/showproblem.php?pid=5253 #include <iostream> #include <bits/stdc++.h& ...