Saturday, October 27, 2012

How to compress and split into smaller files in Linux

http://techlogbook.wordpress.com/2008/03/25/how-to-compress-and-split-into-smaller-files-in-linux/


I want to back up a folder that has a size of more than 6GB and then put it into the CD-ROM. To do this, I compress the folder
zip -r /mnt/ESA/Oka/Old.zip Old/
and then split into smaller size using zipsplit. To check how many files will be created if we want to split into 600MB, type
zipsplit -tn 629145600 /mnt/ESA/Oka/Old.zip
and to split the file, type
zipsplit -n 629145600 /mnt/ESA/Oka/Old.zip
UPDATED
Uh it seems that there is a file size limit with zip. It stops at around 13MB.
so use tar and split instead. Type
tar czvf /mnt/ESA/Oka/Old.tar.gz Old/
to create the archive file, and then
split –-bytes=600m /mnt/ESA/Oka/Old.tar.gz /mnt/ESA/Oka/mysplitfiles/Old.tar.gz.
to split the files and put into mysplitfiles directory. The files will be Old.tar.gz.aa, Old.tar.gz.ab and so on.
To recover them type
cat Old.tar.gz.* > Old.tar.gz
-------------------------------------------------------------------------------------------------------------------------------------------
ตัวอย่าง
C:\Users\Juuier\Desktop>split --bytes=300m ubuntu-12.10-desktop-amd64.iso.zip test/
ubuntu-12.10-desktop-amd64.iso.zip.
C:\Users\Juuier\Desktop>ls test/
ubuntu-12.10-desktop-amd64.iso.zip.aa  ubuntu-12.10-desktop-amd64.iso.zip.ac
ubuntu-12.10-desktop-amd64.iso.zip.ab
C:\Users\Jui\Desktop>cat test/ubuntu-12.10-desktop-amd64.iso.zip.* > test/ubuntu-12.1
0-desktop-amd64.iso.zip

ผลการตรวจสอบไฟล์ที่ recover กลับมา md5checker ตรงกัน



No comments:

Post a Comment

Popular Posts