Lesser known linux commands: dirsplit

dirsplit splits directory into multiple with equal size. If you have 8gb files  and you want to write them into DVD’s, then dirsplit can break them into directories of fixed size say 4.2gb. Here is an example

ram@rhlaptop:~/tmp$ du -sh /home/mm
1.4G    /home/mm
ram@rhlaptop:~/tmp$ du -sh
ram@rhlaptop:~/tmp$ dirsplit -s 700M -l /home/mm/
Building file list, please wait…
Calculating, please wait…
………………..
Calculated, using 2 volumes.
Wasted: 11066 Byte (estimated, check mkisofs -print-size …)
ram@rhlaptop:~/tmp$ du -shL vol_1 vol_2/
701M    vol_1
664M    vol_2/

dirsplit has created two directories vol_1 and vol_2 which have symbolic links (-l option) to files in /home/mm. The size of directories are  701 and 664.

dirsplit will be very useful for copying data into DVD’s/CD’s. It has option to create list for mkisofs catalog, so that burning is easier.

I remember a utility I wrote way back in 1989/90. In those days, backup were done on magnetic tapes. We had 45MB/60MB tapes. The data required to be backed up will be about 100-150MB. That means we require more than one tape. I used cpio to backup. It will prompt for additional tape when it reaches end of one medium. However, the problem was while recovering. If first tape is corrupt, then rest of tapes are non-readable, thus whole backup is waste. So I wrote a c programme – called cpioalloc – to create a list of filenames such that each list will contain specified size say 45 or 60mb. Now using the list I will copy data in individual tapes. Thus minimising loss in case of bad media. dirsplit is several thousand times better than the utility I wrote.

One Response to Lesser known linux commands: dirsplit

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: