Jump to content

Make cab


Kudos

Recommended Posts


put all your files in a single folder

at the cmd prompt, use CD command to go in that folder

use this to compress all files :

FOR %i IN (*) DO MAKECAB /D CompressionMemory=21 %i

(the part in italic enables the max compression level)

you'll get all the compressed files mixed up with the originals, to move the cabbed ones to a folder, use the MOVE command :

MOVE *.??_ X:\Path\to\Cabbed\files\*.*

++

Link to comment
Share on other sites

You don't need to move them later, if you build in a delete command!

Copy all the files, if you want them keeping in an uncompressed form, to a folder, then drag and frop the folder onto this file.

  • cabem.cmd

@PUSHD %1 ||EXIT
@FOR /F "DELIMS=" %%? IN ('DIR/B/A-D') DO (@MAKECAB "%%?">NUL 2>&1 &&@DEL /A/F "%%?")

It should be on two lines only!

<Edit>

If you want the safety of not deleting and not copying first, here's a safer version. It will create a folder inside the one you dropped named cabbed, and place all your newly cabbed files inside it, leaving the originals alone

  • cabit.cmd

@PUSHD %1 ||EXIT
@FOR /F "DELIMS=" %%? IN ('DIR/B/A-D') DO (@MAKECAB "%%?" /L "CABBED">NUL 2>&1)

This one is two lines too!

</Edit>

Edited by Yzöwl
Link to comment
Share on other sites

You don't need to move them later, if you build in a delete command!

Of course, but i'm lazier than you :P

May i ask you what is the difference between :

FOR %i IN (*) DO something with the file %i

-and-

FOR /F "DELIMS=" %%? IN ('DIR/B/A-D') DO something with the file %%?

hidden files maybe ?

++

edit: thanks Yzöwl ;)

Edited by Delprat
Link to comment
Share on other sites

It just picks up more files, for instance any which contain additional dots in the filename. It also has the added benefit of being quicker to edit using findstr in regular expressions for instance.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...