Reputation: 5
I'm trying to get a list of files from a directory in DOS and I would like to exclude any files that START with "I_"
I can get it to exclude anything with I_ but that excludes it if it doesn't start with it. Here's my script >
dir /s /b c:\TEST | findstr /vi "\c:\TEST\I_." > c:\TEST\List.txt
Anyway to get "I_" to be excluded ONLY when it's the start of the word (ie I_TEST)?
Upvotes: 0
Views: 1669
Reputation: 4132
You haven't exactly defined "word," but if you mean that a file or directory name begins a word, then adding the dirsep to the search string should do the trick.
dir /s /b c:\TEST | findstr /vi "\I_" > c:\TEST\List.txt
Upvotes: 1