sunlight76
asked on
Compress all files...
Hi,
I need to compress all files in a directory (wzzip) but creating one zip file for each file.
Tried to use FOR command but can't get it.
Could you help me ?
Thanks.
Win2000 pro
I need to compress all files in a directory (wzzip) but creating one zip file for each file.
Tried to use FOR command but can't get it.
Could you help me ?
Thanks.
Win2000 pro
The example from Steve using the "~n" modifier
to expand only the filename portion without the extension
should also work for you through CMD.EXE under Windows 2000 ...
If not, what is the error when using the For command?
Is the problem with its use of wildcards with your filenames?
If so, a workaround for the COMMAND.COM For command
is to first Copy or Rename the files to remove the extension
and then process the files with For using only one wildcard,
then afterwards rename the files back, or delete the copies,
depending on whether you want to keep the original files ...
So a method for Windows 9.x or DOS mode
(using PKZIP) could go like this:
@echo off
cls
copy *.* *
for %%x in (*) do pkzip %%x %%x
for %%x in (*) do del %%x
You can substitute the Ren command for the Copy command
to rename and then remove your original files after zipping --
but CD to the working directory from within the batch file
and not run the batch file from the working directory.
Alternatively you can specify a file extension
in the For set if they're all the same ...
Post back if it doesn't help or you need other methods
and give an example of the filenames you're zipping...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for you answer and sorry for the delay
for %%i in (*.*) do wzzip %%~ni %%i
Good Luck,
Steve