Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a directory containing several large files that are each greater than 4gb. I want to copy all of those files to a different directory (happens to be a fat32 usb drive mounted), but split the files down to 4gb (since the destination drive is limited to that size files).

I tried this:

split -b 4096G /var/lib/backuppc/images/* /usbdrive/

but I get a

split: extra operand `/var/lib/backuppc/images/xxxxxxxxxmyfilesname.tib'

Am I doing something wrong? (also tried "4G" instead of 4096G, no difference)

share|improve this question
    
Did you try with 4G ? –  Maxime R. Dec 20 '11 at 15:33
    
yes, just did, no difference –  Scott Szretter Dec 20 '11 at 15:47

2 Answers 2

My suggestion would be to first create a tar file:

tar -cf /tmp/bigfile.tar /var/lib/backuppc/images/*

then split that:

cd /usbdrive
split -b 4G /tmp/bigfile.tar

If you want to avoid use of the temporary tar file you can pipe tar directly to split:

tar -cf - /var/lib/backuppc/images/* | split -b 4G

To reconstruct this when you get to the destination, recreate and unarchive the tar file:

cat /usbdrive/x* >bigfile.tar
tar -xvf bigfile.tar

Again, to do this without the temporary file:

cat /usbdrive/x* | tar -xvf -
share|improve this answer

split can't take more than one input file as an argument.

You can try using find for this

cd /var/lib/backuppc/images && find . -maxdepth 1 -type f -exec split -b 4G '{}' "/usbdrive/images/{}" \;
share|improve this answer
    
getting there, now getting: /usbdrive/images//var/lib/backuppc/images/Acer_Veriton_X498G_Desktop_Win_7_Pro_O‌​A_FACTORY_BU.tibaa: No such file or directory (and my /usbdrive/images/ directory does exist) –  Scott Szretter Dec 20 '11 at 17:11
    
Sorry, forgot to take spaces into account, please see the edited command. –  arrange Dec 20 '11 at 17:57
    
Or, if you don't insist on split and preserving permissions etc, use 7z for example: 7z -v4g -mx0 a /usbdrive/images/images.7z /var/lib/backuppc/images. –  arrange Dec 20 '11 at 18:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.