Re: How to list a directory "all except"

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Brian Cluff
Date:  
To: Main PLUG discussion list
New-Topics: Re: How to list a directory "all except" SOLVED
Subject: Re: How to list a directory "all except"
A few more just to mix it up a bit.

Delete lines from ls output that have htm at the end
ls -ltr |sed '/\.htm$/d'

You can also use perl, the swiss army club:
ls -l |perl -n -e 'print unless /\.htm$/'

This one might be the most efficient of the bunch, since it's all in one
command:
find -not -iname "*.pdf" -printf "%M %2n %u %g %8s %Cb %Cd %CY %f\n"

This is a cool one that is bash specific, but it only works on the
current directory:
shopt -s extglob
ls -lt !(*.htm)

Brian Cluff

On 08/07/2013 08:04 AM, wrote:
> What syntax would one use to list all the contents
> of a directory *except* those of a specified criteria?
>
> For example, I know that: ls -ltr *htm
> lists all contents ending in 'htm'
>
> But how could I list all contents excluding those ending in 'htm'?
>
>
>
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
>

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss