Solved

Shell script to batch convert ps files to pdf with ps2pdf

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
After running Ubuntu some time, you will be asked to download updates for fixing bugs and security updates. All the packages you download replace the previous ones, except for the kernel, also called "linux-image". This is due to the fact that w…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now