On 11 Jun 99, you wrote...
>
> find /f elephant c:\directoryname\*.txt > zoo.txt
>
> This will give me a plain text file that is a list of all the
> files that contain the string "elephant" in a file called zoo.txt
>
> And here is where I get stuck. How do I pass the filenames from
> zoo.txt back to the batch file and delete them?
>
This is a good enough reason to recommend folks use 4DOS to replace
their command.com files. It would make this job rather easy so I
just found out. The machine I'm on now has just MS-DOS 5 (my DR-DOS 7
machine is gone) and I noticed there's no find command. Since I'm
using 4DOS it's not a problem.
Anyway, I did a couple of tests to see how this works.
I created three text files with only text1 and text3 having elephant
in it. The FOR command is used along with an arbitrary variable.
The following batch successfully deleted just the two files
that had elephant in them.
ffind /b /t"elephant" *.txt > zoo.txt
for %d in (@zoo.txt) [do] del %d
Note that this is with 4DOS and the internal ffind command.
The /b means bare so only the filename and path is returned and not
all the other stuff that ffind would normally include.
I also tried it with Norton's FileFind but again it includes extra
stuff also which means some cutting would have to be done in zoo.txt.
The FOR variable, %d, is set for each file in zoo.txt (I suppose
that's like 'for %%d in (text1.txt text3.txt) do del %%d' with regular
command.com?). I think regular command.com, or at least older ones,
require two % signs in batch files but only one from the command line.
DO is optional which is why I put it in brackets.
Anyway, I don't know if regular DOS supports the @filename thing.
I pulled out an old (1989) MS-DOS Batch Files book to check on the FOR
command for vanilla DOS. It includes some good examples but nothing
about that. It is old.
Look into the FOR command though to see if that would help.
--
>> ANIME SENSHI <<
Marc D. Williams
[EMAIL PROTECTED] PC Magic Network
[EMAIL PROTECTED] The MailBox BBS
http://www.agate.net/~tvdog/internet.html -- DOS Internet Tools
http://www.geocities.com/SiliconValley/Platform/8269/ -- Win3.x Makeover
To unsubscribe from SURVPC send a message to [EMAIL PROTECTED] with
unsubscribe SURVPC in the body of the message.
Also, trim this footer from any quoted replies.