How to use find command to find all files with extensions from list?

后端 未结 9 1504
旧时难觅i
旧时难觅i 2020-12-04 05:45

I need to find all image files from directory (gif, png, jpg, jpeg).

find /path/to/ -name \"*.jpg\" > log

How to modify this string to f

9条回答
  •  醉梦人生
    2020-12-04 06:33

    In supplement to @Dennis Williamson 's response above, if you want the same regex to be case-insensitive to the file extensions, use -iregex :

    find /path/to -iregex ".*\.\(jpg\|gif\|png\|jpeg\)" > log
    

提交回复
热议问题