computing
  • 4

batch code to list the contents of a folder

  • 4

I need a batch code to list the contents of a folder. Except I need it to exclude the files file1.bat, file3.bat, and file6.bat. I’m using the code “dir C: /B/S/A:-D>list.txt” and I get

file1.bat
file2.bat
file3.bat
file4.bat
file5.bat
file6.bat

but I want it to read

file2.bat
file4.bat
file5.bat

can I have some help.

Share

1 Answer

  1. There’s no exclude-list option in the dir command, nevertheless I think you can do an after batch trimming using search and replace in your .txt file for each occurences of your exclude-words.

    By the way, I have a blog post about free virus protection, in case you are looking for one.

    • 0