Tuesday, 9 April 2013

Unzip a bunch of DOCX word docs in windows cmd to make it easy to grep

This may seem like a strange thing to do, but you might want to use grep on a bunch of windows docx files to search for content easily... instead of using the windows file indexer..
@echo off
cd "C:\someFolderFullOfDocs"
for /r . %%G IN (*.docx) DO (
 echo %%G
 echo %%~nxGdir
 mkdir %%~nxGdir
 cd %%~nxGdir
 "C:\Program Files\java\jdk1.5.0_22\bin\jar" xf "%%G"
 cd "C:\someFolderFullOfDocs"
 )

No comments:

Post a Comment