Raised This Month: $32 Target: $400
 8% 

Batch file / create bz2's in mass quantities


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SlimeCounty
SourceMod Donor
Join Date: Jun 2011
Old 07-10-2012 , 06:35   Batch file / create bz2's in mass quantities
Reply With Quote #1

So, I was compressing tons of custom models, sounds, vmt's and vtf's (custom source materials, etc) this morning, and I mean TONS, doing each manually, getting them ready for my fastdl server. My buddy Squirrel pops into group chat, knows what I'm doing, and throws this batch file at me.

Works like a flipping charm. I thought I'd post it somewhere on these forums, as I feel this is something pretty damn useful for source server owners who compress/upload custom content in large quantities.

I'll attach the file below, but this file assumes 2 things...
7zip is installed in C:\Program Files\7-Zip\7z.exe
and that you want your files compressed to the .bz2 format.

HOW IT WORKS

First, you must have 7zip installed.
Place the .bat file into a directory containing all the files you wish to compress and drag those files into the .bat file, stand back, and watch as it compresses each file into it's own .bz2.

Here's the script, in case you need to change something to suit it for your needs.
Simply copy that into a new txt file, and name it whateveryouwant.bat.

Code:
@Echo Off
:Start
If [%1==[ Goto :EOF
PushD %~pd1
"C:\Program Files\7-Zip\7z.exe" u -tbzip2 %~nx1.bz2 %1
Shift
PopD
Goto Start
Attached Files
File Type: zip bz2.zip (236 Bytes, 3309 views)
__________________

Last edited by SlimeCounty; 07-10-2012 at 06:40.
SlimeCounty is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 07-10-2012 , 06:53   Re: Batch file / create bz2's in mass quantities
Reply With Quote #2

Wow, Imma have to try this.
ReFlexPoison is offline
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 07-10-2012 , 07:25   Re: Batch file / create bz2's in mass quantities
Reply With Quote #3

Does it crawls trough all the directories to? Cause you can allready drag & drop multiple files on the default bzip2.exe
Groger is offline
SlimeCounty
SourceMod Donor
Join Date: Jun 2011
Old 07-10-2012 , 10:04   Re: Batch file / create bz2's in mass quantities
Reply With Quote #4

Quote:
Originally Posted by Groger View Post
Does it crawls trough all the directories to? Cause you can allready drag & drop multiple files on the default bzip2.exe
No, it only compresses what you drop in it. Only time I've had any experience with bz2 was with 7zip, and there's no bzip2.exe in my installation.
__________________
SlimeCounty is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-10-2012 , 10:36   Re: Batch file / create bz2's in mass quantities
Reply With Quote #5

One thing I miss having moved to a Windows server from a Linux server is the ability to wget maps and things directly to my fast download server, and then be able to bzip2 -k *.bsp to convert them all to bz2.

Edit: -k was to keep the original bsp files so I could then use sftp to upload the files to my game server.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-10-2012 at 15:25.
Powerlord is offline
SlimeCounty
SourceMod Donor
Join Date: Jun 2011
Old 07-10-2012 , 12:07   Re: Batch file / create bz2's in mass quantities
Reply With Quote #6

That does sound nice.
__________________
SlimeCounty is offline
checkster
BANNED
Join Date: Apr 2007
Location: Norway
Old 07-10-2012 , 15:05   Re: Batch file / create bz2's in mass quantities
Reply With Quote #7

This will save some time for those who do not have a auto bzip on they're cite. Nice share bro.

Last edited by checkster; 07-10-2012 at 15:06.
checkster is offline
Fearts
ferts of daeth
Join Date: Oct 2008
Old 07-10-2012 , 21:57   Re: Batch file / create bz2's in mass quantities
Reply With Quote #8

This is very nice indeed. What compression level does it use?


EDIT:

My friend DHack sent me this link:

http://www.brainless.us/downloads.aspx?cid=1
__________________

Last edited by Fearts; 07-10-2012 at 22:08.
Fearts is offline
natino
Member
Join Date: Aug 2011
Old 07-11-2012 , 02:53   Re: Batch file / create bz2's in mass quantities
Reply With Quote #9

can you use these compressed files by just putting them in the directory or on a webserver?
natino is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-11-2012 , 15:26   Re: Batch file / create bz2's in mass quantities
Reply With Quote #10

Quote:
Originally Posted by natino View Post
can you use these compressed files by just putting them in the directory or on a webserver?
I've heard that they will be used for downloads if you put them on the game server, but they're intended for a fast download webserver.

Side note: The game server itself doesn't understand bz2, so you must put the uncompressed maps on the game server itself.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode