Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I need to zip all the .csv files in a folder file by file..i donot want to zip the entire folder..just the csv files in a folder...
suppose i have 10 .csv files in a folder..then my .bat script should zip these 10.csv into 10 individual .zip files...
this is because to save the space on the drive and if in future if we required a particular file we can reuse it...
i tried using zip command in cmd prompt it is throwing a error like use binary mode...Please help me with a .bat script.
Regards,
Reshma
"i tried using zip command in cmd prompt it is throwing a error like use binary mode..."
No tellin' what that means.
::=====================
@echo off
setLocal EnableDelayedExpansionfor /f "tokens=* delims= " %%a in ('dir/b/a-d *.csv') do (
pkzip %%~Na %%a
)
=====================================
If at first you don't succeed, you're about average.M2
Report Offensive Follow Up For Removal
Thanks for the script..but i am unable to zip using the pkzip command..the prompt was showing pkzip is not recognized as an internal or external command..i replaced it by zip command , it was working...but there are no file extensions for the files which were ziped...i need to have .zip extension..please help me how to keep the extension for the file which have been zipped.
Regards,
Reshma
Report Offensive Follow Up For Removal
What ZIP are you using?
Maybe more to the point, why not use PKZIP which is very widely known. It's probably not going too far to say the PKZIP is the de facto standard.
=====================================
If at first you don't succeed, you're about average.M2
Report Offensive Follow Up For Removal
Hi ,
If i am use pkzip i am getting the below error
'pkzip' is not recognized as an internal or external command,
operable program or batch file.I tried it on both os..winn xp and win server 2003.
so i used only zip...
Regards,
Reshma
Report Offensive Follow Up For Removal
In order to use pkzip you need to HAVE pkzip.
=====================================
If at first you don't succeed, you're about average.M2
Report Offensive Follow Up For Removal
Hi ,
we donot have any utility installed on our server.can't we use zip instead of pkzip.
Regards,
Reshma
Report Offensive Follow Up For Removal
You still haven't answered: what ZIP?
As far as I know there's no zip that part of any version of windows.
=====================================
If at first you don't succeed, you're about average.M2
Report Offensive Follow Up For Removal
I am using the below script
@echo off
setLocal EnableDelayedExpansionfor /f "tokens=* delims= " %%a in ('dir/b/a-d *.csv') do (
zip %%~Na %%a
)
Regards,
reshma
Report Offensive Follow Up For Removal
![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |