Mailinglist Archive: opensuse (1047 mails)

< Previous Next >
Re: [opensuse] list of directories containing a specific file type
  • From: Per Jessen <per@xxxxxxxxxxxx>
  • Date: Fri, 15 Jan 2016 12:09:03 +0100
  • Message-id: <n7ak0f$h61$1@saturn.local.net>
Istvan Gabor wrote:

Hello:

I would like to search for all the directories containing files with
jpg extension (*.jpg) on my system. The output should list only the
directory paths, one path only once either it contains one or more
*.jpg files. The file names should be omitted. I'd like to do it in a
bash terminal. Is this feasible? I looked at the find command but
could find how to get the wanted output.

Try this:

find . -type f -name \*jpg -printf "%h\n" | sort -u



--
Per Jessen, Zürich (3.6°C)
http://www.hostsuisse.com/ - virtual servers, made in Switzerland.

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
References