tags:

views:

31

answers:

1

Hi all,

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 with .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.

+1  A: 

Use findstr to filter:

dir /b /s /-p *.sas /o:n | findstr /E .sas >"%CD%"\WIN_file_list.txt
Joey
Hi Johannes, Do you know why this script might work on two Vista/7 machines, but not work on an XP Pro machine?Thanks
newbie_dev
@newbie_dev: I don't have access to machines with ancient versions of Windows but I suspect the `/E` switch was added later. You can use `findstr /R .sas$` instead, I think.
Joey