Files and directory structure

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

User avatar
JRL
Automation Wizard
Posts: 3505
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Jan 09, 2006 9:25 pm

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

Robbyn
Junior Coder
Posts: 43
Joined: Tue Feb 15, 2005 9:55 pm

Post by Robbyn » Mon Jan 09, 2006 10:03 pm

Thanks. I will use a MS script to do it.
Robin

User avatar
JRL
Automation Wizard
Posts: 3505
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Jan 09, 2006 11:08 pm

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

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Jan 10, 2006 2:53 am

Good work Dick.

I should not have limited my thoughts to DIR in my reply.
Using /V with FIND is a great idea.

Put some "attaboys" into your account! :D
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts