Home » English » Convert multiple ps files into pdf using ps2pdf

Convert multiple ps files into pdf using ps2pdf

Unfortunately ps2pdf doesn’t allow that. But with a script as simple as that it will convert all ps files in your working directory into pdf and delete the original files:

#!/bin/bash
##
## Written by Leonard Burtscher (burtscher@mpia.de)
## 20 Apr 2010
##
##
## PURPOSE
##
##
## To transform all ps files of a directory into pdf using ps2pdf
## Then delete all ps files
##
filelist=`(find . -name \*.ps)`
for i in $filelist; do
ps2pdf $i
rm $i
echo ‘Converted $i into pdf, deleted original file.’
done
#!/bin/bash

filelist=`(find . -name \*.ps)`

for i in $filelist; do

        ps2pdf $i

        rm $i

        echo 'Converted $i into pdf, deleted original file.'

done

4 Comments

  1. ridernet says:

    thank you for your help, but the command “find . -name *.ps” didn’t work I used “find . -perm -000” and make sure that only files that have to be converted in the directory

  2. ileo82 says:

    I guess the -name option is only available in Apple’s version of find, and not in GNU find.

  3. Tany says:

    Many thanks for this useful tool!

  4. klaus says:

    Hi,
    thanks that really helped me a lot.

Leave a comment