How to? Pass output from ffind to another command in a BTM file

Feb 23, 2012
240
3
Hi,
I'd like to run ffind in a BTM file in order to retrieve a specific line from a text file, and then I'd like to pass that line to another command. (Specifically, the text file contains a list of filenames and paths; ffind will extract the relevant line, based upon the input parameter to the BTM file, and then I'd like to pass that path+filename to the copy command, to copy the specified file to another location).
Does anyone have any sample BTM code that would demonstrate how to accomplish this task?
 
Feb 23, 2012
240
3
Ah, I think I see now. The help file explains that I can use @CON: in order to direct piped output to a specific place on the command line. So, I can just write:
ffind /k /m /t%1 filepaths.txt | copy @CON: c:\destination
This does the trick.

Hi,
I'd like to run ffind in a BTM file in order to retrieve a specific line from a text file, and then I'd like to pass that line to another command. (Specifically, the text file contains a list of filenames and paths; ffind will extract the relevant line, based upon the input parameter to the BTM file, and then I'd like to pass that path+filename to the copy command, to copy the specified file to another location).
Does anyone have any sample BTM code that would demonstrate how to accomplish this task?
 
May 20, 2008
12,033
127
Syracuse, NY, USA
Hi,
I'd like to run ffind in a BTM file in order to retrieve a specific line from a text file, and then I'd like to pass that line to another command. (Specifically, the text file contains a list of filenames and paths; ffind will extract the relevant line, based upon the input parameter to the BTM file, and then I'd like to pass that path+filename to the copy command, to copy the specified file to another location).
Does anyone have any sample BTM code that would demonstrate how to accomplish this task?
How about @EXECSTR[]?

Code:
COPY %@EXECSTR[FFIND /K /M /T%1 filepaths.txt] c:\destination
 
May 20, 2008
12,033
127
Syracuse, NY, USA
That's a more elegant approach, provided you only want the first line.
It sounded like Avi wanted only one line. For more (or one, I suppose), DO might work.

Code:
DO file IN /P FFIND /K /M /T%1 filepaths.txt
COPY %file c:\destination
ENDDO
 

Similar threads