Computing.Net > Forums > Programming > zip all the .csv files in a folder

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to get for your free account now!

zip all the .csv files in a folder

Reply to Message Icon

Name: Reshma
Date: July 23, 2008 at 10:56:19 Pacific
OS: win xp
CPU/Ram: intel core duo
Manufacturer/Model: 2003
Comment:

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


Report Offensive Message For Removal

Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: July 23, 2008 at 13:05:48 Pacific
Reply:

"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 EnableDelayedExpansion

for /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

Response Number 2
Name: Reshma
Date: July 24, 2008 at 00:39:32 Pacific
Reply:

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

Response Number 3
Name: Mechanix2Go
Date: July 24, 2008 at 01:15:17 Pacific
Reply:

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

Response Number 4
Name: Reshma
Date: July 24, 2008 at 01:25:25 Pacific
Reply:

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

Response Number 5
Name: Mechanix2Go
Date: July 24, 2008 at 01:35:00 Pacific
Reply:

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

Related Posts

See More



Response Number 6
Name: Reshma
Date: July 24, 2008 at 01:39:42 Pacific
Reply:

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

Response Number 7
Name: Mechanix2Go
Date: July 24, 2008 at 03:07:30 Pacific
Reply:

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

Response Number 8
Name: Reshma
Date: July 24, 2008 at 03:59:29 Pacific
Reply:

I am using the below script

@echo off
setLocal EnableDelayedExpansion

for /f "tokens=* delims= " %%a in ('dir/b/a-d *.csv') do (
zip %%~Na %%a
)


Regards,
reshma


Report Offensive Follow Up For Removal
Reply to Message Icon






Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: zip all the .csv files in a folder

Move all the .csv files not in .txt www.computing.net/answers/programming/move-all-the-csv-files-not-in-txt/16740.html

delete files in a folder (batch) www.computing.net/answers/programming/delete-files-in-a-folder-batch/14570.html

Move the first file in a folder www.computing.net/answers/programming/move-the-first-file-in-a-folder-/19043.html