Raised This Month: $12 Target: $400
 3% 

Batch file / create bz2's in mass quantities


Post New Thread Reply   
 
Thread Tools Display Modes
Aqua Dark
AlliedModders Donor
Join Date: Aug 2009
Location: Canada
Old 07-12-2012 , 02:18   Re: Batch file / create bz2's in mass quantities
Reply With Quote #11

Just use MinGW to do all files in a directory so say you have all your files in C:\ToBebzip2 it would find and bzip2 all the files you have in it and will keep the directory structure too.

To use this you'll need MinGW (here) and MSYS (here) If you need help here's the setup and install guild http://www.mingw.org/wiki/InstallationHOWTOforMinGW When installing MinGW make sure you get the bzip2 lib.

Once installed open MSYS run this command
Code:
find 'C:\YOUR PATH' -type f -exec bzip2 -9 '{}' \;
So say your files/folders are in C:\bzip2 and you have the folders "models" and "maps" in it. Your path would be C:\bzip2 and it will find all the files and folders inside C:\bzip2 and .bz2 them for you.
__________________
Aqua Dark is offline
SlimeCounty
SourceMod Donor
Join Date: Jun 2011
Old 07-12-2012 , 08:01   Re: Batch file / create bz2's in mass quantities
Reply With Quote #12

That sounds slightly more complicated than simply dragging files into a batch folder which uses a prog many server owners already have, but hey, alternative methods are always helpful, thanks for sharing!
__________________
SlimeCounty is offline
Aqua Dark
AlliedModders Donor
Join Date: Aug 2009
Location: Canada
Old 07-12-2012 , 22:55   Re: Batch file / create bz2's in mass quantities
Reply With Quote #13

Quote:
Originally Posted by SlimeCounty View Post
That sounds slightly more complicated than simply dragging files into a batch folder which uses a prog many server owners already have, but hey, alternative methods are always helpful, thanks for sharing!
For the most part just click nest on the installers. The hardest part would be clicking "Download latest repository catalogues" in the MinGW installer it's the only thing you click on other then next. For the cmd popup in the MSYS installer type "y" "y" "C:\MinGW" and your done.

I like this because if you got mass files to do it looks something like this not just two folders with maybe 10 files where your .bat would be faster, but that's just me.
__________________
Aqua Dark is offline
cruzzin
New Member
Join Date: Jul 2012
Old 07-13-2012 , 13:08   Re: Batch file / create bz2's in mass quantities
Reply With Quote #14

its not working for me cmd comes up then shuts down.
cruzzin is offline
Aqua Dark
AlliedModders Donor
Join Date: Aug 2009
Location: Canada
Old 07-13-2012 , 20:28   Re: Batch file / create bz2's in mass quantities
Reply With Quote #15

Quote:
Originally Posted by cruzzin View Post
its not working for me cmd comes up then shuts down.
Did you type this into it before it closed "y" "y" "C:\MinGW"?
__________________
Aqua Dark is offline
SlimeCounty
SourceMod Donor
Join Date: Jun 2011
Old 07-13-2012 , 20:29   Re: Batch file / create bz2's in mass quantities
Reply With Quote #16

Quote:
Originally Posted by cruzzin View Post
its not working for me cmd comes up then shuts down.
Are you talking about the batch file method or Aqua's preferred MinGW method?
If you're talking about the batch file I posted, keep in mind that you don't run the batch file itself, you drag the files you wish to compress into it, and of course you must have 7zip installed, which brings up another point I made in the first post, that you must check the location of your 7zip installation against what is there in the script of the batch file.

"C:\Program Files\7-Zip\7z.exe"

If that does not match your install location, change it accordingly.
Hope that helps.
__________________
SlimeCounty is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 07-16-2012 , 02:21   Re: Batch file / create bz2's in mass quantities
Reply With Quote #17

I don't know why you guys make it so complicated. In Windows 7 (and Vista), you could move all the files you want to bz2 to a folder, then in the search bar (up top) put in "." (without the quotes) and it lists all files and folders. Then drag all of them into the bzip2 executable file and it will auto bz2 all of them.
minimoney1 is offline
SlimeCounty
SourceMod Donor
Join Date: Jun 2011
Old 07-16-2012 , 08:25   Re: Batch file / create bz2's in mass quantities
Reply With Quote #18

Quote:
Originally Posted by minimoney1 View Post
I don't know why you guys make it so complicated.
Well, there is no bz2 executable with my particular installation of 7zip, but hell yeah, that does sound nice, clean and easy.

Quote:
I WHOLEHEARTEDLY DISAGREE WITH SLIMECOUNTRY, THIS IS FAR EASIER, AND SOMETIMES IT'S JUST WHAT YOU NEED!
Awesome! Whatever works, maybe I'll give that a shot!
__________________
SlimeCounty is offline
Aqua Dark
AlliedModders Donor
Join Date: Aug 2009
Location: Canada
Old 07-17-2012 , 02:12   Re: Batch file / create bz2's in mass quantities
Reply With Quote #19

Quote:
Originally Posted by minimoney1 View Post
I don't know why you guys make it so complicated. In Windows 7 (and Vista), you could move all the files you want to bz2 to a folder, then in the search bar (up top) put in "." (without the quotes) and it lists all files and folders. Then drag all of them into the bzip2 executable file and it will auto bz2 all of them.
Yes that works but now your not using the best compression by doing that, using the .bat or the MSYS you can set the compression level so the files are smaller then just dropping them on a bzip2.exe. As you can see in my command line I have set -9 (or --best) to use the best compression for bzip2 v.s. drag and drop -1 (or --fast). I'm not sure if SlimeCounty as set it in his .bat or not, but it dose make a big differenced for people who have slower connection speeds even if it's only 5MB.
__________________
Aqua Dark is offline
invermere
Junior Member
Join Date: Nov 2011
Old 12-10-2013 , 17:32   Re: Batch file / create bz2's in mass quantities
Reply With Quote #20

I couldn't get that first script to work, so I made a slight variation. Not sure if it's a Win7 thing (?) but after doing a little research on command line and 7z command line I had to change the output pathname to get the absolute path, like the input path needs to be. Oh an also specified the Ultra compression for the archive... not sure if that's on by default. Don't ask me why, but this works for me and if anyone else has issues with the OP try this.

Code:
@Echo Off
:Start
If [%1==[ Goto :EOF
PushD %~pd1
"C:\Program Files (x86)\7-Zip\7z.exe" u -tbzip2 -mx9 %1.bz2 %1
Shift
PopD
Goto Start
I would include the batch file, but it says invalid file type, so you can just make your own and put this in there. Simply drag all the files you want to compress on to the file and it will go to town.
invermere is offline
Reply


Thread Tools
Display Modes

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 05:02.


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