I don't know any way of doing what you want to do with the DOS dir command.
Depending upon what you want to do with the list, the DOS xcopy command does offer an /exclude:listname option. You could create a list to exclude by running DIR path\*dog*.pdf /b /s > tempdog.txt.
You could do the same "dir to a file" to create a list from which to make comparisons within MS. However I think that simply looking at each filename one at a time and looking for the string "dog" would be faster.
One way to do that would be to use the separate function.
Let>k=0
Label>start
Let>k=k+1
Readln>YourDosCreatedFile,%k%,line
If>line=##EOF##,end
Let>line={Upper(%line%)}
separate>line,DOG,var
If>var_count>1
///DOG exists in the string
Else
///DOG does not exist in the string
EndIf
Goto>start
Label>end
Hope this helps,
Dick
Files and directory structure
Moderators: Dorian (MJT support), JRL
Robbyn,
I think I'm approaching that point in life where I've forgotten more than I currently know. I forgot about DOS "find"
Try this, it will be a case sensitive "find"
Run>cmd /c dir path\*.* | find /v "dog" > c:\~~~nolistdog~~~.txt
This, will be case insensitive.
Run>cmd /c dir path\*.* | find /I /v "dog" > c:\~~~nolistdog~~~.txt
The "/I" removes case sensitivity.
The "/v" tells "find" to exclude the search text line.
Note that the "line" containing "dog" is removed, so if "dog" is part of a directory name and you set up the dir to include dierctory names (eg. dir /s /b) the line will be removed.
For Information about find type "find /?" at a DOS prompt.
Hope this helps,
Dick
I think I'm approaching that point in life where I've forgotten more than I currently know. I forgot about DOS "find"
Try this, it will be a case sensitive "find"
Run>cmd /c dir path\*.* | find /v "dog" > c:\~~~nolistdog~~~.txt
This, will be case insensitive.
Run>cmd /c dir path\*.* | find /I /v "dog" > c:\~~~nolistdog~~~.txt
The "/I" removes case sensitivity.
The "/v" tells "find" to exclude the search text line.
Note that the "line" containing "dog" is removed, so if "dog" is part of a directory name and you set up the dir to include dierctory names (eg. dir /s /b) the line will be removed.
For Information about find type "find /?" at a DOS prompt.
Hope this helps,
Dick
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact: