buda-base / drs-deposit

Harvard DRS Deposit base
1 stars 0 forks source link

Use file names to generate sequence in make-drs-batch.sh #33

Closed jimk-bdrc closed 6 years ago

jimk-bdrc commented 6 years ago

make-drs-batch.sh depends on file globbing to generate the sequence for files:

    for f in $v/* ; do
            # cp and rename each image
                fullNm=$(basename $f)
                ext="${fullNm##*.}"

                # jsk: 12.21.17: Issue #14
                 if $(isBannedExt ${ext} ) ; then continue ; fi
                fnm="${fullNm%.$ext}"
                # WRONG: suffix=$(printf %04d $pageSeq)
                # This transform makes the file name comply with PDS sequencing
                destNm="$pdsName--${fnm}__${suffix}.$ext"           
                cp $f $templateDir/$destNm
                pageSeq=$[pageSeq + 1]
            done

$fnm is usally Wxxxxx-IyyyyyNNNN. We want to use NNNN as the sequence. This would remove the dependency that all the files in the directory ($v/*) have identical file names. (They may be required, for other reasons, but not for this one.) have suffix be the last 4 numeric characters in fnm, formatted into 000n

jimk-bdrc commented 6 years ago

Commit f24227