62

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

Abbas Mousavi
  • 721
  • 1
  • 5
  • 5

3 Answers3

99

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...

ptim
  • 1,356
  • 10
  • 10
  • 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. – Andy Ibanez Feb 19 '17 at 21:42
  • Yow! sorry ta hear that... in my tests, the md5 matches nicely :( maybe an OS discrepancy? – ptim Feb 20 '17 at 12:09
  • updated with a quick test... video still plays! – ptim Feb 20 '17 at 12:24
  • When I put my ISO back together I could explore some folders without an issue. Sadly I can't really test if it was rebuilt properly as I don't have a device that can reproduce that kind of ISOs right now. – Andy Ibanez Feb 20 '17 at 12:50
  • 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 '17 at 09:31
  • 1
    As of 2021-06, this method is working for me. I've checked with `md5sum`. – alvaro g Jun 24 '21 at 07:09
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!

Hamed Rajabi
  • 796
  • 8
  • 11
  • 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.` – Sam Malayek Oct 24 '18 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 '19 at 05:52
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

bdecaf
  • 468
  • 1
  • 5
  • 14