Reputation: 326
Let's say we have:
What I want to do is, to get zips of every eps, jpg couple with the same names like:
I can't figure out how to do this. Any suggestions?
Upvotes: 0
Views: 1986
Reputation: 2872
Here is my example with windows native zip.exe. It looks for only *.eps files inside of current directory (because you have pair of files with the same name and different extensions), then it extracts filename, adds .eps and .jpg extensions and zip them with same name.
for /r %i in (*.eps) do zip %~ni.zip %~ni.eps %~ni.jpg
If you write inside of script then white with %%i
for /r %%i in (*.eps) do zip %%~ni.zip %%~ni.eps %%~ni.jpg
Upvotes: 1
Reputation: 23240
You can do it easily with help of WinRAR:
@setlocal
@echo off
set path="C:\Program Files\WinRAR\";%path%
forfiles /s /m *.jpg /C "cmd /c winrar.exe a -afzip "@fname.zip" "@fname.eps" "@fname.jpg"
pause
Upvotes: 2