LinuxAnswers - the LQ Linux tutorial section.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 06-25-2011, 01:44 PM   #1
LQ Newbie
Registered: Apr 2004
Location: Toronto CA
Distribution: fedora
Posts: 20

Rep: Reputation: 0
How to write a loop command for pdf2djvu

How do I write a loop command to periodically check a given folder and then create a djvu file from any pdf it finds.
pdf2djvu works great but I'm looking to set up a "hot folder" for general office staff to use.
Old 06-25-2011, 10:29 PM   #2
Registered: Apr 2004
Location: Costa Rica
Distribution: slack current with (still off the hook)
Posts: 284

Rep: Reputation: 33
Well in my opinion this is what cron is for, you can just have the script to look in to that folder for new files or modified within X amount of time and convert it, then setup the crontab of the user that will execute it every X amount of minutes, days or whatever you need.
Old 06-25-2011, 11:54 PM   #3
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian except for netbook still on Slackware 13.37 (and I have to support Ubuntu)
Posts: 8,572
Blog Entries: 30

Rep: Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182Reputation: 1182
Which languages can you use? Can you call inotify?
Old 06-28-2011, 01:47 PM   #4
LQ Newbie
Registered: Apr 2004
Location: Toronto CA
Distribution: fedora
Posts: 20

Original Poster
Rep: Reputation: 0
This is what I have so far.
It works great except if it kick's in while someone is uploading a pdf file.
The pdf gets deleted before it's processed.

find /home/qwikchk/ -iname '*.pdf' -print0 | xargs -0 -IX pdf2djvu -o X.djvu X
mv /home/qwikchk/*.djvu /var/www/html/qwikchk/files/
rm -f /home/qwikchk/*.pdf
chown -R apache:apache /var/www/html/qwikchk/


loop, pdfs

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Bash: how do I write an infinite loop? stf92 Linux - Newbie 9 11-13-2010 06:23 AM
pdf2djvu centguy Linux - Software 7 08-18-2009 10:04 PM
how to write such type of loop in shell George2 Programming 4 09-14-2007 07:15 AM
for loop to retrieve info and write approbiate line of code? ati Programming 2 05-07-2006 12:07 PM

All times are GMT -5. The time now is 09:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration