开发者

Outputting contents of DIR command to file by specific extension

开发者 https://www.devze.com 2023-01-09 09:56 出处:网络
I have the following command that I have in a BAT file: dir /b /s /-p *.sas /o:n >\"%CD%\"\\WIN_file_list.txt

I have the following command that I have in a BAT file:

dir /b /s /-p *.sas /o:n >"%CD%"\WIN_file_list.txt

The goal is to have a file that contains the full path of ONLY files wit开发者_开发知识库h .sas extension.

The problem is that when I run the above script, it outputs everything with sas in the extension. The file contains all of the .sas files that I want, but also all of the .sasb7dat files that I do not want in the new txt file.

Any insight would be appreciated.

Thanks in advance.


Use findstr to filter:

dir /b /s /-p *.sas /o:n | findstr /E .sas >"%CD%"\WIN_file_list.txt
0

精彩评论

暂无评论...
验证码 换一张
取 消