2
Some time ago I came to the need to use the Microsoft Office Document Imaging to convert a document template created in Microsoft Word as an anti-copy prevention measure of the model itself (positioning, measurements, definitions, etc.).
But the application in question, for those who do not know, is very spartan, slow and with some weird restrictions too for a GUI. Fortunately, the functionality I needed could be executed on the command line.
I’ve never been a big fan of batch scripts, but I still chose to create a file. BAT to automate OCR of MDI files previously generated by the virtual printer provided by the application.
Like the syntax of batch scripts it was old stuff when I got my first computer, I never bothered to learn more than necessary to install Windows 98 (at the time) and I ended up with the following file:
@echo off
set filesCount=0
echo Performing OCR over files
echo.
for /r %%i in (*.mdi) do (
set /a filesCount+=1
echo Curent file: %%i
"C:\Program Files\Common Files\Microsoft Shared\MODI\11.0\MSPVIEW.EXE" -f %%i
echo OCR performed succesfully
echo.
)
echo.
echo OCR performed over %filesCount% files found
echo.
pause
It works well, but I have to duplicate (or move) the file. BAT for each directory before running it. And because execution is applied to thousands of hierarchically structured files in several sublevels, it becomes a tedious task almost not making it worth using said script.
Is it possible to modify this script to operate recursively? That way, I would store it in the parent directory of all sublevels and run it once.
I tested it here and your bat is already running the command recursively, just run it in the root directory...
– Jader A. Wagner
@Bruno wants to run this command recursively over his entire root directory?
– Mansueli
@Jader: Really? I confess I never tried it to see what would happen. Perhaps because the PC I would use is coal-powered. Kyllopardium: Not in the root directory, but from a root. Something like . / of *Nix. From where . BAT lies forward (or "inside")
– Bruno Augusto
look at the test I did: print obviously I removed the line with the executable, but you can see that it takes all the files in all directories...
– Jader A. Wagner
I will try it only Monday, at the service. In the interim, if you want to answer with this test, I would be happy to evaluate and mark as solved. But only Monday :p
– Bruno Augusto