Splitting and merging large files in Linux

In some cases you won't be able to transfer very large files using storage devices. So the best way is to use split a given file in to arbitrary no of volumes at the source and them merge at the destination.
This will simply do that for you.

Splitting

Say you have a directory/file called 'foo'. First you need to create a '.tar.gz'.


tar -cvzf foo.tar.gz foo

Then you can split it using split command and as a parameter you can give the size of a each volume. (here its 25MB)


split -d -b25m foo.tar.gz foo.tar.gz.


Merge

Simply you can merger using the cat command.

cat foo.tar.gz.0* >foo.tar.gz


Now you can untar this and use the original file/directory.

Comentários

Postagens mais visitadas deste blog

Understanding Reactor Pattern with Java NIO

A new journey.. A new working place.. WSO2 Inc.