Solved

Shell script to batch convert ps files to pdf with ps2pdf

Posted on 2008-10-20
3
2,164 Views
Last Modified: 2013-12-06
As part of our DR/BC plan, our Linux-based application creates 100's of .ps Postscript files, but I need to convert these to PDF files.  I know the ps2pdf will do this for me, but I would like a cronjob script to automate this for me.

I have confirmed that ps2pdf works properly with manual operations, but I would like a script in a cron job to automate the converson.  

I have very limited linux scripting and mega experience with Windows vbscripting.  I could move these files to a Windows system, but I prefer to use Linux.

Something along this method of psuedocode:

for each $file in $dir{
ps2pdf $file $file.pdf
}


Any ideas?
Thanks!!
-Kevin
0
Comment
Question by:kevin_buchanan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 500 total points
ID: 22764532
find /in/my/dir -type f -name "*.ps" | while read name
do
     fname=`basename $name`
     ps2pdf $name /my/pdf/dir/$fname.pdf
done
0
 
LVL 84

Expert Comment

by:ozo
ID: 22764536
#!/usr/bin/bash
for   file in $dir/*.ps ; do
ps2pdf $file $file.pdf
done
0
 
LVL 1

Author Closing Comment

by:kevin_buchanan
ID: 31508150
Thanks - that worked GREAT!
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Suggested Courses

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question