如何在 Fat32 上存储大文件

Ale*_*lex 8 fat32

我想在 FAT32 驱动器(~18 GB)上存储一个大型视频文件,但我发现由于文件系统的限制,这不仅仅是可能的。

是否有一个简单的工具可以将文件拆分为可存储的较小部分,然后在我想检索存档文件时重新组合它们?

或者有没有更好的方法在 FAT32 上存储大文件?

Ple*_*and 10

大多数文件归档程序,例如7-Zip、WinZip 和 WinRAR,都允许您将归档文件拆分为多个文件。如果速度很重要,您可以尝试禁用程序的压缩部分。

在 GNU/Linux 系统上,您可以使用coreutils 包中的splitcat程序(例如split -b 4294967295 FOO /media/FATDISK/BAR,将 FOO 拆分为 BARaa、BARab ……并cat /media/FATDISK/BAR?? > FOO重新组装它)。Mac OS X 的命令行split实用程序以相同的方式工作。


Ale*_*lex 5

如果您正在寻找对此的快速解决方案,请参阅其他以7zip或为特色的答案split这是一个更有趣的解决方案。

我最终编写了一个小的 Python 2 脚本来实现这一点。


# Author: Alex Finkel 
# Email: alex@finkel.net

# 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()
Run Code Online (Sandbox Code Playgroud)

  • -1代表[重新发明轮子](https://en.wikipedia.org/wiki/Not_invented_here)。 (3认同)
  • +1 用于分享他们将来可能对其他人有用的工作。另外,如果没有人重新发明轮子,*总有一天没有人会知道如何发明轮子*。 (2认同)