Solved

Shell script to batch convert ps files to pdf with ps2pdf

Posted on 2008-10-20
3
2,116 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
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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

In order for businesses to be compliant with certain information security laws in some countries, you need to be able to prove that a user (which user it was becomes important to the business to take action against the user after an event has occurr…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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