How to store large files on Fat32

Most file archivers, such as 7-Zip, WinZip, and WinRAR, allow you to split an archive across multiple files. If speed is important, you can try disabling the compression part of the program.

On GNU/Linux systems, you can use the split and cat programs from the coreutils package (e.g. split -b 4294967295 FOO /media/FATDISK/BAR to split FOO into BARaa, BARab, ... and cat /media/FATDISK/BAR?? > FOO to reassemble it). Mac OS X's command line split utility works in the same way.


If you are looking for a quick solution to this, please see the other answers featuring 7zip or split. This is more of a fun solution.

I ended up writing a small Python 2 script to achieve this.


# Author: Alex Finkel 
# Email: [email protected]

# This program splits a large binary file into smaller pieces, and can also 
# reassemble them into the original file.

# To split a file, it takes the name of the file, the name of an output 
# directory, and a number representing the number of desired pieces.

# To unsplit a file, it takes the name of a directory, and the name of an 
# output file.

from sys import exit, argv
from os import path, listdir

def split(file_to_split, output_directory, number_of_chunks):
    f = open(file_to_split, 'rb')
    assert path.isdir(output_directory)
    bytes_per_file = path.getsize(file_to_split)/int(number_of_chunks) + 1
    for i in range(1, int(number_of_chunks)+1):
        next_file = open(path.join(output_directory, str(i)), 'wb')
        next_file.write(f.read(bytes_per_file))
        next_file.close()
    f.close()
                
def unsplit(directory_name, output_name):
    assert path.isdir(directory_name)
    files = map(lambda x: str(x), sorted(map(lambda x: int(x), listdir(directory_name))))
    out = open(output_name, 'wb')
    for file in files:
        f = open(path.join(directory_name, file), 'rb')
        out.write(f.read())
        f.close()
    out.close()
        
    
if len(argv) == 4:
    split(argv[1], argv[2], argv[3])
elif len(argv) == 3:
    unsplit(argv[1], argv[2])
else:
    print "python split_large_file.py file_to_split output_directory number_of_chunks"
    print "python split_large_file.py directory name_of_output_file"
    exit()