| 1. |
Solve : Redirect result from FINDST (or FIND) to COPY, to copy certain files? |
|
Answer» Hello, have a folder with hundreds of text files, but only a hand full have the keyword "glossary"in them. I need to find these files and copy them to another folder.You don't need a batch file to copy a few files. Instead of fretting about tough details, do what you can do. You can make the results into a list. Right? Then edit the list with Notepad and turn it into a batch file list instead of a loop. Suppose I had some files with 'man' in the name. The I might get a list for text files like this: Code: [Select]pacman.txt rayman.txt mandate.txt fatmanhop.txtUsing Notepad, I would put a # at the stat of each line and a $ at the end of the line. Code: [Select]#pacman.txt$ #rayman.txt$ #mandate.txt$ #fatmanhop.txt$Even on a list of up to one hundred items, you can do this rather fast. Humans are like that. I am a human. Next, I would tell notepad to replace every # with the word 'copy' with a space after it. Then back to top, replace every $ with a space and the target path. When the above is done, I save may 'list.txt' files as 'list.bat' and run it as a bat file. The time from concept to finish can be under half an hour. Or, you can spend another day on loops and debugging. The METHOD I use is easier to visualize. Because you see it. And you can do exceptions very easily. one line of code... Code: [Select]for /f "delims=" %%A in ('findstr /i /M "glossary" *.txt') do copy "%%A" "\newfolder\" Code: [Select]for /F "delims=" %%G in ('findstr /i /M "glossary:" *.txt') do copy "%%G" C:\NewFolder Salmon beat me! Quote from: Squashman on July 31, 2012, 11:26:39 AM Salmon beat me! But you gave the more faithful reproduction of the OP's wishes; I overlooked the colon after "glossary". Still, I expect the OP would have figured it out. I want a batch code to search a string exactly like "Interpretation (Interpret) Passed" from a set of HTML files locatind in folders and subfolders and send the files which contain that string to another folder. similarly i wanna even search "Interpretation (Interpret) Failed" and "Interpretation (Interpret) Incomplete" from html files and send to specified folder. i tried with the code mentioned below: echo OFF for /f "delims=" %%f in ('findstr /S/M /C:"Interpretation (Interpret) Failed" *.html') do copy "%%f" C:\\failedreports for /f "delims=" %%f in ('findstr /S/M /C:"Interpretation (Interpret) Incomplete" *.html') do copy "%%f" C:\incompletereports for /f "delims=" %%f in ('findstr /S/M "Interpretation (Interpret) Passed" *.html') do copy "%%f" C:\Passed But this code doesn't work .... Any Help Pls?? Its very urgent Pls help me out Thanks in advance.... The Topic is almost 2 years old... Please start a new Topic if you need a solution...Hi patio, i already created a new post named-''To search and send "Interpretation (Interpret) Passed" Exactly from Html files'' SINCE no one responded there posted here to see if some GURU replies,..... If some1 knows the solution pls reply in that post mentioned above .... Thank u in advance:)***sigh*** |
|