printf 'n Log-%02d.tar\n' {2..}|tar cf /var/opt/sw/e4/data/dev/e4_dev/DEVL3/EW/EWD1/DATA/AED/OUTPUT/Log-01.tar -ML1900m /var/opt/sw/e4/data/dev/e4_dev/DEVL3/EW/EWD1/DATA/AED/Temp

I tried to use the above code to tar 1000 files whose file size (varies) greater than 2 GB, which needs to be archived as 1.9 GB separate TAR files.

For example, if there are 1500 files of size 7 GB, it needs to be archived as (7 GB/1.9 GB) 4 tar files: log-01.tar, ..., log-04.tar but I got the error:

printf: {2..} expected numeric value
tar: -ML1900m: No such file or directory

What should I change here? Is there a way to do this without using create volume method in GNU tar?


The error message basically says what the problem is, "1900m" is not recognised as an argument to '-L', and the man-page for tar explains it. You (quite sensibly as "m" is the prefix for "milli", which doesn't make sense with bytes) must use a capital "M" when you want to specify a number of megabytes (taractually uses mebibytes, but let's not get into that).

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