a13x Posted October 13, 2004 Share Posted October 13, 2004 Ok, I know how to compress a file. zip -r archive.zip file But, how can I split it in several archives of given size ? For example, I have a 5 MB file. I compress it and it's size is reduced to 1.5 MB. I would like the compression utility to break the archive in 2 750KB archives. How do I do this ? [moved from Software by spinynorman] Link to comment Share on other sites More sharing options...
Gowator Posted October 13, 2004 Share Posted October 13, 2004 I think yopu might need to use bzip2 (although Im not sure) I know this CAN do it becuase its used as backend for some progs that do it... Link to comment Share on other sites More sharing options...
aRTee Posted October 13, 2004 Share Posted October 13, 2004 (edited) Check the command split, if you just want to split that thing up into 2 files half the size. man split Remember, it is already compressed. I hope this is what you need, in which case it's really funny, since you said it already: But, how can I split it in... Makes me thing back of that time I wanted to rename who ranges of files and finally found that I was looking for the 'rename' command... Edited October 13, 2004 by aRTee Link to comment Share on other sites More sharing options...
a13x Posted October 13, 2004 Author Share Posted October 13, 2004 I was hoping to do it all from one command. Anyway, I played a little with split and it does what I want. How do I merge all those files to one (the 'merge' command ?) ? I've read the bzip2 man page but it doesn't mention any splitting. Link to comment Share on other sites More sharing options...
DragonMage Posted October 14, 2004 Share Posted October 14, 2004 Well.. I don't usually zip files from cli, but there is a command called zipsplit that splits a zip file into a few files. Link to comment Share on other sites More sharing options...
Guest duncangareth Posted October 14, 2004 Share Posted October 14, 2004 How about a shell script: Something like: # gzsplit - gzip a file, then split it # Change default size if you like - this is 10K DEFAULTSIZE=10240 NARGS=$# case $NARGS in 2) SIZE=$1; FILE=$2 ;; 1) SIZE=$DEFAULTSIZE; FILE=$1;; *) echo "Usage: tgzsplit <filename>"; exit 1;; esac if [ -r $FILE ] then gzip -9 $FILE ; split -b $SIZE $FILE.gz $FILE else echo "gzsplit: file $FILE not found." exit 1 fi To re-assemble the file, simply say: cat filename?? > filename.gz then gunzip it. Link to comment Share on other sites More sharing options...
a13x Posted October 15, 2004 Author Share Posted October 15, 2004 Hey, this looks nice. Thx. I'll take that the problem are solved and mark the thread solved - Artificial Intelligence Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now