MSFN Forum: makecab everything in a folder - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

makecab everything in a folder Rate Topic: -----

#1 User is offline   fdv 

  • MSFN Expert
  • Group: Developers
  • Posts: 1,109
  • Joined: 16-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 05 February 2008 - 01:21 PM

Hey TP and TC, I found a little file to makecab everything in a folder in some other subforum but it didn't work, and was an abandoned topic. Since HFSLIP has this functionality, would either of you fellows mind terribly posting a file to just do one thing -- makecab every single file in a folder? (Except the utility itself of course, and stopping when all files are done, instead of continuing forever to makecab the files already done once).

It would've helped me during my NT4 odyssey, but truth is I was working so slowly anyway I didn't even think of it :blink:


#2 User is offline   zedox 

  • XPize Darkside Author
  • PipPipPipPipPip
  • Group: Members
  • Posts: 708
  • Joined: 25-August 05

Posted 05 February 2008 - 07:34 PM

I think the program you might be after is called CabPack.

#3 User is offline   fdv 

  • MSFN Expert
  • Group: Developers
  • Posts: 1,109
  • Joined: 16-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 06 February 2008 - 01:04 AM

Cabpack makes CAB files.

I need to run makecab on every file in a directory to make the files go from

FILE1.EXE
FILE2.EXE

to
FILE1.EX_
FILE2.EX_

#4 User is offline   ctpooon 

  • Newbie
  • Group: Members
  • Posts: 35
  • Joined: 22-July 06

Posted 06 February 2008 - 01:25 AM

hi fdv,

first, download makecab from the following link
http://support.microsoft.com/kb/310618

then

1. create a empty file
2. copy the code under into the file
3. change c:\makecab to the directory that you would like to make all files into cab
4. save the as makecab.cmd (or anything end with .cmd)
5. put the cmd file next to the bin/MAKECAB.exe you just downloaded from microsoft.
6. double clicking the cmd should make all the files in directory c:\makecab into a xxxx.xx_

rem @echo off
for %%a in (c:\makecab\*.*) do MAKECAB %%a
pause


#5 User is offline   fdv 

  • MSFN Expert
  • Group: Developers
  • Posts: 1,109
  • Joined: 16-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 06 February 2008 - 09:27 PM

Nope. Test first.

Anyone?

Attached File(s)



#6 User is offline   Kelsenellenelvian 

  • WPI Guru
  • Group: Developers
  • Posts: 8,322
  • Joined: 18-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 06 February 2008 - 09:50 PM

Xperos eXPander or jcarles Compression bin BOTH do what you are looking for.

#7 User is offline   ctpooon 

  • Newbie
  • Group: Members
  • Posts: 35
  • Joined: 22-July 06

Posted 07 February 2008 - 12:59 AM

View Postfdv, on Feb 7 2008, 02:27 PM, said:

Nope. Test first.

Anyone?


tested again. working on both of my machines.

have a look in your d:\1-windows-NT4 to see if there is any *.*_

Attached File(s)


This post has been edited by ctpooon: 07 February 2008 - 01:02 AM


#8 User is offline   fdv 

  • MSFN Expert
  • Group: Developers
  • Posts: 1,109
  • Joined: 16-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 07 February 2008 - 02:20 PM

ctpoon, thanks, but the program only loops forever, and does the same file over and over, and never actually produces any output. No idea why.

Xperos eXPander - Google search, MSFN search produce no results

jcarles Compression bin - relies on framework (but I gotta install framework anyway eventually I suppose).

ctpoon, BTW, does your name mean you are fond of ladies in Connecticut? :sneaky:

#9 User is offline   tommyp 

  • MSFN Addict
  • Group: Developers
  • Posts: 1,675
  • Joined: 09-January 04
  • OS:none specified
  • Country: Country Flag

Posted 07 February 2008 - 03:34 PM

For argument sake, lets say the files you want to compress is located in a folder called INPUT.
Create a folder called OUTPUT and the the compressed files will end up here.
Open a dosbox in the root of the INPUT and OUTPUT.

Put this code in your dosbox.

FOR /F %I IN ('DIR /B INPUT') DO makecab HF\%I /L OUTPUT

If you prefer, you can change the %I to %%I both times if you want to use it in a batch (cmd) file. You'll need to place the cmd file in the same directory as the input and output folders.

#10 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,363
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 12 February 2008 - 11:15 AM

I don't know if this is what you want but here goes:
The attached archived 'compiled' batch file (you need to extract it!) takes a directory as a parameter. You do this by dropping your directory onto it.
What happens is that it will makecab all files* in the top level of that directory and upon success delete the uncompressed version.
This action will be performed without showing a console window, so be careful that the process is finished prior to messing with the directory. Also due to this hiding of the console window your anti-malware scanners may warn you about this file. It is of course up to you whether you continue or not.
* - All files will exclude individual files which are already cabbed or cab archives.


Please note that this file was intended for use on Windows XP and may fail in any other OS.

I hope it helps!

Attached File(s)

  • Attached File  CabAll.7z (93.46K)
    Number of downloads: 286


#11 User is offline   fdv 

  • MSFN Expert
  • Group: Developers
  • Posts: 1,109
  • Joined: 16-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 12 February 2008 - 04:36 PM

Thanks, Wise; this is awesome... just perfect.
You can advertise it as working in 2000 too BTW.

EDIT: aw, crud. It works, but Windows NT4 cannot extract the files. So the problem is with NT4's EXPAND which probably can be replaced with 2000's. Oddly, when files are compressed in 2000 with the 2000 native MAKECAB, NT4 seems to do fine.

This post has been edited by fdv: 13 February 2008 - 01:20 AM


#12 User is offline   Yzöwl 

  • Wise Owl
  • Group: Super Moderator
  • Posts: 4,363
  • Joined: 13-October 04
  • OS:Windows 7 x64

Posted 13 February 2008 - 06:45 AM

My guess is that it's because my executable is using LZX compression which I think wasn't an option in the earlier incarnation of makecab and therefore also in the extraction utility.

In the attachment this time there are two different versions:
  • MSZIP - file ver 1.0.0.1 - This should allow the file to be extracted in the earlier OS
  • LZX - file ver 1.0.0.2 - This is as the previous version I posted, with a small difference.
The difference is that I have included the XP SP2 version of Makecab as part of both of these executables. This gives you the opportunity to run them without worrying about having makecab installed in %PATH% and to guarantee functionality.

Neither have as yet been tested for stupid mistakes!

Attached File(s)



#13 User is offline   Kiki Burgh 

  • MSFN Expert
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,426
  • Joined: 06-January 06

Posted 18 February 2008 - 02:52 AM

View Postfdv, on Feb 8 2008, 04:20 AM, said:

Xperos eXPander - Google search, MSFN search produce no result
hi fdv! :) here's the new download link for XPero's utilities, specifically eXPander

#14 User is offline   fdv 

  • MSFN Expert
  • Group: Developers
  • Posts: 1,109
  • Joined: 16-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 08 April 2008 - 05:34 PM

Add Compress as a context menu option to .DLL and .EXE files

A bump because I figured out a REALLY simple way to work with files.

Although this won't makecab everything in a folder, it will add Compress as a context menu option to dll and exe files. You can select several of both kinds and it will makecab them all: select as many DLL and EXE files as you want and left click and you will see "Compress" as an option. Select it, and every one of your selected files will be compressed.

 
[Version]
signature="$Windows NT$"

[DefaultInstall]
AddReg = addreg

[addreg]
HKCR,"exefile\Shell\Compress\command",,,"%11%\makecab.exe ""%1"""
HKCR,"dllfile\Shell\Compress\command",,,"%11%\makecab.exe ""%1"""
HKCR,".dl_\Shell\expand\command",,,"%11%\expand.exe -r ""%1"""
HKCR,".in_\Shell\expand\command",,,"%11%\expand.exe -r ""%1"""
HKCR,".ex_\Shell\expand\command",,,"%11%\expand.exe -r ""%1"""
HKCR,".sy_\Shell\expand\command",,,"%11%\expand.exe -r ""%1"""
 


#15 User is offline   os2fan2 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 417
  • Joined: 09-September 04

Posted 10 April 2008 - 01:20 AM

You could use 'compress.exe' from the resource kit.

compress -r * outputdir

#16 User is offline   fdv 

  • MSFN Expert
  • Group: Developers
  • Posts: 1,109
  • Joined: 16-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 10 April 2008 - 12:27 PM

View Postos2fan2, on Apr 10 2008, 02:20 AM, said:

You could use 'compress.exe' from the resource kit.

compress -r * outputdir


As far as I can see though that creates a dot Z file, it doesn't makecab FILE.SYS >> FILE.SY_

#17 User is offline   Oleg_II 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 679
  • Joined: 06-August 04

Posted 11 April 2008 - 05:54 PM

There is a great tool from one of the board members - jdoe. It's here.

I use its previous version with batch files ;) It adds two lines to Send To context menu: "CAB expand" and "CAB make". And it makes File.ex_ from separate files and Folder.cab files from folders :thumbup

This post has been edited by Oleg_II: 11 April 2008 - 06:24 PM


#18 User is offline   os2fan2 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 417
  • Joined: 09-September 04

Posted 12 April 2008 - 02:17 AM

Compress.exe from the Windows resource kit, is the reverse of Expand.exe.

COMPRESS [-r] [-d] [-z] Source Destination
COMPRESS -r [-d] [-z] Source [Destination]

  -r			Rename compressed files.
  -d			Update compressed files only if out of date.
  -zx		   LZX compression.
  -z			MS-ZIP compression.
  -zq[n]		Quantum compression and optional level
				(in range 1-7, default is 4).
  Source		Source file specification.  Wildcards may be used.
  Destination   Destination file | path specification.
				Destination may be a directory.
				If Source is multiple files and -r is not specified,
				Destination must be a directory.


The level of compression given by makecab is identical with compress -r -zx filename outdir

By itself, compress -r file outdir, gives a compression identical with Windows 3.10 (any kind).

For windows XP and above ye find compress.exe in the reskit. For 2k, it is rath found by google.

#19 User is offline   ritter_devil 

  • Group: Members
  • Posts: 5
  • Joined: 20-September 08

Posted 11 August 2010 - 07:27 AM

rem @echo off
for %%a in (*.*) do MAKECAB %%a
pause
_______________________________________________

Put this script in your folder with files you want to cabcompress
Make sure that at the end you delete cabcompressed cmd file.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy