Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi...I'm wondering if anyone knows how to search for specific filenames, then list all other files that don't match that format. the format is
??_??_??.*
Any other file that doesn't match this should be listed, then printed.
Thanks

To be clearer, the "Find" command is defined as follows:
"The find command searches files for the string or text that you specify"
I need to find everything else that the find command does NOT specify.
Is there a way oh enlightened ones?

Not clear what you want to do.
but FIND is for finding 'strings' in text files, NOT for finding files.
You can:
dir ??_??_??.*
Try to restate what you want to do.
If at first you don't succeed, you're about average.M2

Also, it will depend on the version of DOS.
The ability to do a dir/s was added in DOS 5.0 or 6.x, so if your DOS is earlier, you'll have different issues vis-a-vis finding files not in the current directory.
In brief, to get two lists, one with the file names which contain a _ and another list of files which don't:
dir |find "_" > with_.lst
dir |find /v "_" > no_.lstGetting down to a list with the _ in particular positions will take much more doing.
Let us know.
If at first you don't succeed, you're about average.M2

If you can accept a two pass solution, first make a list of all file names, then delete those that match your search pattern. I believe a utility like grep will delete the unwanted names from the list.

Hi Michdosboy
This help.
----------------------
@echo off
attrib +h ??_??_??.*
dir /b /a-d-h > prn
attrib -h ??_??_??.*

Wow, dtech10's solution was perfecto. You are truly a dynamic genious. Thanks alot!
One question, for some reason, the >prn part of the batch file was actually crashing the execution of the batch file. Any idea why?
But, the gist of the code you gave me works beautifully.
Thanks so much.

Actually, that code works perfectly except when I add a "/s" switch to the "dir" command, it still lists files with the "??_??_??.*" format. It only excludes the files on the current directory, but I need to search thru all subdirectories.
Anyone know why?

Nevermind. I figured it out. Here's my code now:
attrib +h ??_??_??.* /s
dir /s /b /a-h-d
attrib -h ??_??_??.* /s
Thanks for all your help guys.Anyone have any hints on printing this list?
Thanks.

Hi Mike
This work ok.
attrib +h ??_??_??.* /s
dir /s /b /a-h-d > File.txt
attrib -h ??_??_??.* /s
print File.txt

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |