Solved

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

Posted on 2008-10-27
2
402 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

Get Actionable Data from Your Monitoring Solution

Your communication platform is only as good as the relevance of the information you send. Ensure your alerts get to the right people every time with actionable responses. Create escalation rules that ensure everyone follows the process and nothing is left to chance.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Make the most of your online learning experience.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

717 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