What do I need in order to extract and combine text files from multiple ZIP files, via command line?
- by Iszi
I've got an interesting scripting challenge in front of me. I'm fairly certain there's a way to do it, but I feel like I'm probably lacking some particular tools and/or functional knowledge.
There's some fifty-plus ZIP files that each contain, among other things, text files that need to be merged with one another. The structure is something like this:
C:\Reports\FirstJob-1.zip
|-MyName
|-FirstJob
|-1
|-[Some other folders]
|-TXTReports
|-English
|-[Some other files]
|-Report.txt
C:\Reports\FirstJob-2.zip
|-MyName
|-FirstJob
|-1
|-[Some other folders]
|-TXTReports
|-English
|-[Some other files]
|-Report.txt
C:\Reports\SecondJob-1.zip
|-MyName
|-SecondJob
|-1
|-[Some other folders]
|-TXTReports
|-English
|-[Some other files]
|-Report.txt
If I had all the Report.txt files in one regular folder, and uniquely named, I could probably just write a FOR statement that targets *.txt and runs something like type filename.txt >> Consolidated.txt on each. However, these all have the same file name and are embedded deep within separate ZIP files.
The potentially useful tools I currently have at my disposal are Windows XP Professional SP3, PowerShell, and WinZip. I'd rather not download or install anything else, but I do understand that third-party tools (or additional tools from Microsoft or WinZip) may be necessary. Whatever tools I use should run natively in Windows. I really don't want to have to mess with Cygwin or other emulators on this system.
At the very least, I need a tool that will allow me to analyze and manipulate ZIP files from the command line. Also, are there any other particular complications to this that I've not yet thought of?