Linux - search files with find command (with exclude)

Linux - search files with find command (with exclude)

Good day,

I would need to use the find command to find and list all files without a path, except (exclude) for the following file types:
.jpeg
.jpg
.png
.diff
.diff.gz

It is possible? Thank you

REPLY


Hello

on linux using find, you will find all files without paths in the / home / user directory except for the following file types:
.jpeg
.jpg
.png
.diff
.diff.gz

with this command:
find /home/user -type f \! -name '*.jpg' \! -name '*.jpeg' \! -name '*.JPG' \! -name '*.JPEG' \! -name '*.png' \! -name '*.PNG' \! -name '*.diff' \! -name '*.diff.gz' \! -name '*.directory' -printf "%f\n" > /home/user/vypis.txt

You could also use the "ls" command:
ls -LR /home/user --ignore={"*.JPG","*.JPEG",,"*.jpg","*.jpeg","*.png","*.PNG","*.diff","*.directory","*.diff.gz"} /home/user > /home/user/vypis-ls.txt

Související obsah

linux

bash

terminal

find

Komentáře

Vaše reakce na Linux - vyhledání souborů pomocí find s vyjímkami (exclude)

Reference

Podívejte se na naše reference

Prohlédnout

Aplikace

Podívejte se na naše aplikace

Prohlédnout

Co umíme?

Podívejte se co umíme

Prohlédnout

Co umíme?

Vytváříme sofistikované aplikace pro náročné

Od webových aplikací přes android až po převodové můstky či složité informační systémy.

Podívejte se k nám

Máte ještě čas? Podívejte se na další rubriky

Tento web používá soubory cookie. Dalším procházením tohoto webu vyjadřujete souhlas s jejich používáním.. Více informací zde.