How to list a directory "all except"

kitepilot at kitepilot.com kitepilot at kitepilot.com
Wed Aug 7 08:23:21 MST 2013


Or better yet:
ls -ltr | grep -vE 'htm$|somethingelse'
Look at '-i' (case insensitive) option too.
ET 

 

sean ritzler writes: 

> To answer your last question specifically: 
> 
> ls -ltr | grep -v htm$ 
> 
> I don't know if ls has some sort of exclude option, so I would just use grep. 
> 
> Sean 
> 
> On Wed, Aug 7, 2013 at 8:04 AM,  <joe at actionline.com> 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 - PLUG-discuss at lists.phxlinux.org
>> To subscribe, unsubscribe, or to change your mail settings:
>> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss


More information about the PLUG-discuss mailing list