Solved

WZZIP from command line question

Posted on 2006-06-21
1
403 Views
Last Modified: 2012-06-22
Hi,

I need to recurse through a directory and zip each file individually keeping the same file name... Ie.

1.TXT  ---> 1.ZIP
2.TXT  ---> 2.ZIP

It seems like I used to use something similiar to WZZIP -r *.TXT
0
Comment
Question by:orionpm
1 Comment
 
LVL 30

Accepted Solution

by:
SteveGTR earned 50 total points
ID: 16954316
You could do something like this.

@echo off

setlocal

set rootDir=%~1

if "%~1"=="" set rootDir=.

if not exist "%rootDir%" echo %~1 does not exist.&goto :EOF

pushd "%rootDir%"

for /r "%rootDir%" %%a in (*.*) do echo pkzip "%%a" "%%~na.zip"

popd

I've disabled the pkzip line by echo it out. I'm not even sure of the syntax. This should give you a good start. The batch file accepts a root directory to start in.

Good Luck,
Steve
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

740 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