1.

Solve : List all files except .lst files?

Answer»

Is there a SIMPLE way of doing this in DOS?Pipe the output of DIR through FIND.EXE thus:-

dir | find /v /i ".lst"

Quote


S:\Backup\Test\hide files>find /?
Searches for a text string in a file or files.

FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]

/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/OFF[LINE] Do not skip files with offline attribute set.
"string" Specifies the text string to find.
[drive:][path]filename
Specifies a file or files to search.

If a path is not specified, FIND searches the text TYPED at the prompt
or piped from another command.

S:\Backup\Test\hide files>dir
Volume in drive S is USB_HDD
Volume Serial Number is 6C1A-995E

Directory of S:\Backup\Test\hide files

12/10/2007 15:09 <DIR> ..
12/10/2007 15:09 <DIR> .
12/10/2007 15:03 8 hello.doc
12/10/2007 15:03 8 hello.lst
12/10/2007 15:03 8 hello.txt
12/10/2007 15:09 8 HuLLO.LsT
12/10/2007 15:08 8 HALLO.LST
5 File(s) 40 bytes
2 Dir(s) 222,062,141,440 bytes free

S:\Backup\Test\hide files>dir /b
hello.doc
hello.lst
hello.txt
HuLLO.LsT
HALLO.LST

S:\Backup\Test\hide files>dir | find /I /V ".lst"
Volume in drive S is USB_HDD
Volume Serial Number is 6C1A-995E

Directory of S:\Backup\Test\hide files

12/10/2007 15:09 <DIR> ..
12/10/2007 15:09 <DIR> .
12/10/2007 15:03 8 hello.doc
12/10/2007 15:03 8 hello.txt
5 File(s) 40 bytes
2 Dir(s) 222,062,141,440 bytes free

S:\Backup\Test\hide files>dir /b | find /I /V ".lst"
hello.doc
hello.txt


might be better to USE findstr with "$"
eg
dir /B | findstr /I /V ".lst$"
just in case.just in case what? (I'm curious)

Quote from: contrex on October 12, 2007, 10:26:51 AM
just in case what? (I'm curious)


just in case some file's name might be "important.lsting" ? without trailing $ sign, it will be OMITTED from the results.Oh right. I was just answering the original question

Quote
List all files except .lst files

Maybe the OP should specify what he/she wants


Discussion

No Comment Found