Hello, i need to compress file and it's giganitc file :D the size is about 17-20 GB i need to split it to files in size around 1GB for each part , i tried to googleit and found way using split,cat command and it did not work at all in large files , also it wont work in Windows i need to extarct it on windows machine, thanks in advance
+1
A:
Not tested, something like
gzip -c file.orig > file.gz
CHUNKSIZE=1073741824
PARTCNT=$[$(stat -c%s file.gz) / $CHUNKSIZE]
# the remainder is taken care of, for example for
# 1 GiB + 1 bytes PARTCNT is 1 and seq 0 $PARTCNT covers
# all of file
for n in `seq 0 $PARTCNT`
do
dd if=file.gz of=part.$n bs=$CHUNKSIZE skip=$n count=1
done
Adrian Panasiuk
2009-07-13 15:20:01
That's what `split` does already.
ephemient
2009-07-13 15:28:12
OP says split didn't work.
Adrian Panasiuk
2009-07-13 15:29:22
+3
A:
If you are splitting from Linux, you can still reassemble in Windows.
copy /b file1 + file2 + file3 + file4 filetogether
Joshua
2009-07-13 15:21:30
+2
A:
use tar to split into multiple archives
there are plenty of programs that will work with tar files on windows, including cygwin.
Tim Hoolihan
2009-07-13 15:25:59
+4
A:
You can use the split
command with the -b
option:
split -b 1024m file.tar.gz
It can be reassembled on a Windows machine using @Joshua's answer.
copy /b file1 + file2 + file3 + file4 filetogether
Edit: As @Charlie stated in the comment below, you might want to set a prefix explicitly because it will use x
otherwise, which can be confusing.
split -b 1024m "file.tar.gz" "file.tar.gz.part-"
// Creates files: file.tar.gz.part-aa, file.tar.gz.part-ab, file.tar.gz.part-ac, ...
sirlancelot
2009-07-13 17:59:54
if you don't add a prefix as the last argument after the filename to split you get output in files named xaa, xab, xac, xad....
Charlie
2009-07-13 19:01:25