0

We have a process that executes a DIR on multiple folders to check that the correct documents have been generated by another process.

In each of the target directories we use this command:

dir /A:-D "x:\name of document\_archive\YYYY\MONTH\dd.mm.yyyy\" /b

For one of the directories, we are getting an incorrect number because Thumbs.db is being counted.

How can I change the DIR command (which is actually being execute using xp_cmdshell from SQL Server) to ignore Thumbs.db?

or do I need to actually remove those files as explained here by PeterNetLive ?

1 Answer 1

2

You can redirect the output of the dir command into findstr to filter the lines 'Thumbs.db'. The flag /V displays non-matching lines only, the flag /I makes the search case-insensitive. The full command would be:

dir /A:-D /B "x:\...\" | findstr /V /I "^Thumbs.db$"
1
  • 2
    +1 if you squint hard you can see ls | grep -v :-) Commented May 6, 2015 at 16:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .