Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

WZZIP from command line question

Posted on 2006-06-21
1
Medium Priority
?
419 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
[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
1 Comment
 
LVL 30

Accepted Solution

by:
SteveGTR earned 200 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

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…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

618 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