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
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:
You could also use the "ls" command:
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