Solved

Batch de-compression (zip + rar + ...) for a set of directories (recursively)

Posted on 2008-10-27
2
400 Views
Last Modified: 2013-11-10
I've a large number of *.txt files, all compressed in zip and rar containers.
The containers reside in a directory structure with 2-3 levels.
I need to recursively extract JUST the *.txt files to the root folder, leaving all the other files somewhere else.
0
Comment
Question by:go4java
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 38

Accepted Solution

by:
Shift-3 earned 500 total points
ID: 22814430
Here is a method which utilizes 7-Zip, a free zipping program which has good command-line support.
http://www.7-zip.org

Paste the script below into a text file with a .cmd extension.  Customize the value of the root variable with the location of the root folder.  Install 7-Zip and adjust the prog variable if it is installed to somewhere other than the default location.  Running the script will extract all .txt files from .zip and .rar archives to the root folder.


@echo off
setlocal
 
set root=c:\files
set prog=%programfiles%\7-zip\7z.exe
 
for /F "tokens=*" %%G in ('dir "%root%\*.zip" /A:-D /B /S') do "%prog%" e "%%G" -o"%root%" *.txt -r
for /F "tokens=*" %%G in ('dir "%root%\*.rar" /A:-D /B /S') do "%prog%" e "%%G" -o"%root%" *.txt -r

Open in new window

0
 

Author Comment

by:go4java
ID: 22814619
Perfect, thank you!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Healthcare organizations in the United States must adhere to the guidance of both the HIPAA (Health Insurance Portability and Accountability Act) and HITECH (Health Information Technology for Economic and Clinical Health Act) for securing and protec…
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
Using Adobe Premiere Pro, the viewer will learn how to set up a sequence with proper settings, importing pictures, rendering, and exporting the finished product.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question