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. C++派生类继承父类修饰符

    公式: 继承成员对外的访问属性 = Max{继承方式,父类成员访问级别}: 1.如果子类从父类继承时使用的继承限定符是public,那么(1)父类的public成员成为子类的public成员,允许类以 ...

  2. C-基础:memcpy、memset、memmove、memcmp、memchr

    一,原型 void * memcpy ( void * destination, const void * source, size_t num ); 功能:将以source作为起始地址的数据复制nu ...

  3. 模板引擎freemarker的使用(一)

    配置 了解和学习一下freemarker在项目中的配置与使用,顺便记录下来,知识源于分享,进步源于交流... 我是在ssm中配置的. maven 中需要引入的依赖 <!-- freemarker ...

  4. Linux-fuser

    Linux-fuser 1. 描述 2. 选项3. EXAMPLES4. RESTRICTIONS 限制5. SIGNAL 可用信号 fuser - 使用文件或套接字识别进程 1. 描述 fuser使 ...

  5. css内容补充之其它

    1.overflow 当图片大小,超出div的大小时,可以指定overflow值为auto(带滚动条).hidden(隐藏,只显示一块): hover 当鼠标移动到当前标签上时,以下css属性才生效:

  6. 报错:org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute statement

    org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute statement; SQL [n ...

  7. java内存模型(线程共享部分)

    1.元空间(MetaSpace)与永久代(PermGen)的区别? ----> 1.1 元空间使用的是本机内存(这样的好处是,可以使用的内存空间变大了,没有OutOfMemoryError:Pe ...

  8. UVa-401-Palindromes(回文)

    这一题的话我们可以把映像字符的内容给放入一个字符串常量里面,然后开辟一个二维的字符串常量数组,里面放置答案. 对于回文实际上是很好求的,对于镜像的话,我们写一个返回char的函数,让它接收一个char ...

  9. python虚拟环境的搭建及作用

    Python的虚拟环境可以使一个Python程序拥有独立的库library和解释器interpreter,而不用与其他Python程序共享统一个library和interpreter.虚拟环境的好处是 ...

  10. Leetcode 221.最大的正方形

    最大的正方形 在一个由 0 和 1 组成的二维矩阵内,找到只包含 1 的最大正方形,并返回其面积. 示例: 输入: 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 输出 ...