, , , , ,

There may be occasions when you may need to split a huge file  into smaller pieces for storage restrictions (or if you plan on sending them piece-by-piece to a friend!):

The following nifty trick (picked up from Commandline-fu) explains how a directory, <dir>, can first be tarred and split into smaller pieces and later rejoined as need arises:

$ tar cf - <dir> | split -b<max_size>M - <name>.tar.

Rejoin later with `cat’ and then extact:

$ cat .tar.* |tar xf -

Credit: Commandline-fu.

UPDATE: Problems with the first line of the code is fixed. This arose in the first place because when I put <dir> in the  raw HTML box, it just ignored it since <dir> is not a valid HTML tag (as if I wanted it to be!).