I have like 200 PDF documents that will be saved in a folder (every day), I have to sort them based on a their content. (All pdf-documents have the string "X_P1" or "X_P2" in it)
My first step is to convert the .pdf file to a.txt files using XPDF:
for /r %%i in (*pdf) do "C:\Users\xxx\pdftotext.exe" -layout "%%i"
So I end up with 200 PDF files and 200 text files in a folder.
Looks like this:
p100.pdf
p100.txt
p101.pdf
p101.txt
...
So for the next step I thought of searching for the string "X_P1" in the .txt file with FINDSTR and save the filename as a variable. (e.g. p100) Next step: Move all files that name is the same as the variabel to a folder.
I'm not very familiar with batch/powershell so how can I work with the result from FINDSTR. I thought of maybe using the errorlevels? So if I get ERORRLEVEL 0 move to folder 1 .