формирование флешки hp 16gp

Это вообще помогает?

#!/bin/bash

function getChunk {
    #extract a page range
    gs -q -dNOPAUSE -sDEVICE=pdfwrite -sPageList=$1-$2 -o ${3%%.*}_$(printf %04d $4).pdf $3
}

for file in *.pdf; do

    #Use gs to get the page count
    pgs=$(gs -q -dNODISPLAY -c "($file) (r) file runpdfbegin pdfpagecount = quit")

    #specify the number of pages in each chunk as step
    step=10

    #calculate the number of whole chunks 
    chunks=$(( pgs / step))

    #reset all counters between pdfs
    f=0    #first page to extract in chunk
    l=0    #last page to extract in chunk
    i=0    #chunk counter

    #Extract the whole chunks 
    for ((i=0; i<$chunks; i+=1)); do

        #calculate the first and last pages 
        f=$((i*step+1))
        l=$((f+step-1))
        getChunk $f $l $file $i
    done

    #Pick up any part chunk at the end of the file
    f=$((l+1))
    if [ $f -le $pgs ]; then
        getChunk $f $pgs $file $i
    fi
done

Я позволю тебе разобраться с именами.....

-2
23.04.2020, 15:53
0 ответов

Теги

Похожие вопросы