4 ms·
The "compressed" files includes a header file which records the original file name and the number of parts which make up the compressed file, so it doesn't depe
by DougBTX 12y ago
The "compressed" files includes a header file which records the original file name and the number of parts which make up the compressed file, so it doesn't depend on directory listing to re-combine the parts.
- emn13 12y agoYes, it does. It records the original file name, not the name of the parts, and it needs the names+metadata of those parts (specifically in this case their order) to reconstruct the original file.
- DougBTX 12y agoHere's the script: #!/bin/sh i=0 f=`head -1 $1` n=`tail -1 $1` rm -f $f while [ $i != $n ]; do cat $1.$i >> $f i=`expr $i + 1` if [ $i != $n ]; then printf "5" >> $f; fi done The iteration is done with a while loop based on metatdata from the "compressed" file (the number of parts, $n) and the name of the archive ($1). The order of the parts is determined by incrementing $i up to $n, not from eg, the order of the files in the file system, which seems to be what was implied in the comment earlier.