64

I have a 5 GB file on my MAC and can not copy it on flash memory or external hard formatted with FAT. How I can split it to some smaller files

0

3 Answers 3

64

You can use this command on the shell:

split -b YOUR_EXPECTED_SIZES YOUR_FILE_NAME PATTERN_NAME_AS_OUTPUT

and for recovering it

cat SPITED_FILES_AS_LIST > NEW_FILE

I hope it be useful for you!

2
  • 4
    If you get illegal byte count after running split -b 500M input_file.tar.gz output_files.tar.gz., you need to provide the integer byte count: split -b 500000000 input_file.tar.gz output_files.tar.gz. Oct 24, 2018 at 22:30
  • 4
    @LXXIII for what it's worth, I discovered that it's case sensitive! so while -b 20K doesn't work, -b 20k worked like a charm :)
    – fire
    Apr 19, 2019 at 5:52
102

I needed a bit more detail than Hamed's answer offered, here's what works for me, based on comments at hints.macworld.com:

split -b 1024m "YourFile.iso" "YourFile.iso."

This results in as many 1024mb files as required, (and one smaller file at the end) like so:

  • YourFile.iso.aa
  • YourFile.iso.ab
  • ...
  • YourFile.iso.af (the last file will be less than 1024mb)

I like to use the original filename and add . at the end so that it's really clear what the file is at a glance.

I chose 1024mb files because VOBs seem to be that size, and Toast splits files to 1024mb, too - they must have a good reason!

To join these up again:

cat YourFile.iso.* > YourFile.iso

Note that the first argument here ends in .*, which will get all the aa, ab, ac, etc at once.

Also, if the file you're producing already exists, it is silently overwritten (no renamed duplicate like in Finder). The mac version of split is slightly different to the linux version, it seems (for one, numeric suffixes (-d) are not supported).


Update...

Revisiting this following Andy Ibanez's comment that his before and after didn't match... here's my test:

ls -la
total 22336
drwxr-xr-x   3 ptim  staff   102B 20 Feb 23:10 .
drwx------+ 76 ptim  staff   2.5K 20 Feb 23:09 ..
-rw-r--r--@  1 ptim  staff    11M 20 Feb 23:10 test.mp4

split -b 1m test.mp4 test.split.

ls -la
total 44672
drwxr-xr-x  14 ptim  staff   476B 20 Feb 23:10 .
drwx------+ 76 ptim  staff   2.5K 20 Feb 23:09 ..
-rw-r--r--@  1 ptim  staff    11M 20 Feb 23:10 test.mp4
-rw-r--r--   1 ptim  staff   1.0M 20 Feb 23:10 test.split.aa
-rw-r--r--   1 ptim  staff   1.0M 20 Feb 23:10 test.split.ab
-rw-r--r--   1 ptim  staff   1.0M 20 Feb 23:10 test.split.ac
-rw-r--r--   1 ptim  staff   1.0M 20 Feb 23:10 test.split.ad
-rw-r--r--   1 ptim  staff   1.0M 20 Feb 23:10 test.split.ae
-rw-r--r--   1 ptim  staff   1.0M 20 Feb 23:10 test.split.af
-rw-r--r--   1 ptim  staff   1.0M 20 Feb 23:10 test.split.ag
-rw-r--r--   1 ptim  staff   1.0M 20 Feb 23:10 test.split.ah
-rw-r--r--   1 ptim  staff   1.0M 20 Feb 23:10 test.split.ai
-rw-r--r--   1 ptim  staff   1.0M 20 Feb 23:10 test.split.aj
-rw-r--r--   1 ptim  staff   927K 20 Feb 23:10 test.split.ak

cat test.split.* > test.reconstituted.mp4

cat test.mp4 | md5
08db84d1806ec293582d217ed53b034c

cat test.reconstituted.mp4 | md5
08db84d1806ec293582d217ed53b034c

I'm on OSX, but using bash from homebrew, and I been bitten by discrepancies between OS's before... maybe someone else can suggest a reason for md5's not matching in the above scenario...

6
  • I did this and then I did a quick cat YourFile.iso | md5 to verify that that concatenated ISO is indeed the same as the original one. It wasn't. Feb 19, 2017 at 21:42
  • Yow! sorry ta hear that... in my tests, the md5 matches nicely :( maybe an OS discrepancy?
    – ptim
    Feb 20, 2017 at 12:09
  • updated with a quick test... video still plays!
    – ptim
    Feb 20, 2017 at 12:24
  • 1
    I found that when concatenating to an NTFS drive (on Mac using a paragon driver) the result was different, but when concatenating to an HFS+ drive the result was correct. The split files were on the NTFS drive for both attempts.
    – Chris
    Oct 21, 2017 at 9:31
  • 1
    As of 2021-06, this method is working for me. I've checked with md5sum.
    – alvaro g
    Jun 24, 2021 at 7:09
4

Using hard disk utility you can create a sparse bundle on your fat drive. Inside this also larger files are allowed - the system will take care of the rest.

You can also format the stick with HFS or if you need it also on Windows install NTFS-3G and format the drive NTFS

1
  • 4
    Even better format as exFAT, then the whole file works and both Windows and macOS can read and write to it. Sep 9, 2018 at 13:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .