Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #13498

Re: list but not dirs?

From Chris Davies <chris-usenet@roaima.co.uk>
Newsgroups comp.os.linux.misc
Subject Re: list but not dirs?
Date 2015-01-27 11:56 +0000
Organization Roaima. Harrogate, North Yorkshire, UK
Message-ID <tvakpbxlcj.ln2@news.roaima.co.uk> (permalink)
References <pan.2015.01.27.08.20.10@gmail.com>

Show all headers | View raw


Unknown <dog@gmail.com> wrote:
> I want to see all *.pdf [or any *] in all of my 30 workSpace, with each
> having average 3 eTerminals open.

> #!/bin/bash
> echo "List File:Arg1 inAll active Dirs:per:lsof"

Your code appears to try to list all files matching a specified suffix
in the current directory of each process you have running. Is that what
you want?

#!/bin/bash
#
SUFFIX="$1"
echo "Listing files of type $SUFFIX in all active directories"

for DIR in $( lsof -u "$USER" | awk '$4=="cwd" && $5=="DIR" {print $9}' | sort -u )
do
    echo "In directory: $DIR"
    for FILE in "$DIR"/*."$SUFFIX"
    do
	test -f "$FILE" && echo "  $FILE"
    done
    echo
done
exit 0

Chris

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

list but not dirs? Unknown <dog@gmail.com> - 2015-01-27 08:10 +0000
  Re: list but not dirs? Tim Watts <tw_usenet@dionic.net> - 2015-01-27 09:27 +0000
  Re: list but not dirs? Chris Davies <chris-usenet@roaima.co.uk> - 2015-01-27 11:56 +0000
    Re: list but not dirs? Unknown <dog@gmail.com> - 2015-02-03 07:43 +0000
  Re: list but not dirs? Joe Beanfish <joebeanfish@nospam.duh> - 2015-01-28 14:51 +0000
    Re: list but not dirs? Unknown <dog@gmail.com> - 2015-02-03 11:53 +0000
      Re: list but not dirs? Joe Beanfish <joebeanfish@nospam.duh> - 2015-02-03 14:17 +0000
        Re: list but not dirs? Moe Trin <ibuprofin@painkiller.example.tld.invalid> - 2015-02-03 21:56 +0000
      Re: list but not dirs? Rich <rich@example.invalid> - 2015-02-03 18:08 +0000

csiph-web