LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 07-30-2005, 02:37 AM   #1
bhar0761
Member
 
Registered: Jul 2005
Location: San Francisco
Distribution: Fedora Core 6
Posts: 64

Rep: Reputation: 15
watch a folder and then print if files exist


I would like to be able to create or run a program to watchor monitor a specific folder.
When a document gets copied or moved to a the watched folder, I would like to print it and archive to another folder.
There are a number of windows 3rd party software that do this exact thing.
like silentprint.com

B
 
Old 07-30-2005, 04:36 AM   #2
Vgui
Member
 
Registered: Apr 2005
Location: Canada
Distribution: Slackware
Posts: 496

Rep: Reputation: 31
Well, this could be done with a script. A basic idea of how it would work: You would loop (with a sleep break in between), and on each loop you would ls -l the folder, then count the resulting lines. When the lines are greater than the default number, a file has been added, and you can do what you please with that file.
Something like the pseudo script below should get you started in the right direction.

Code:
while (infinite)
sleep X
VAR = $(ls -l /path/to/folder/ | wc -l)
if VAR > 1 # default number of lines in an empty folder)
  print
  move
fi
 
Old 07-30-2005, 02:05 PM   #3
bhar0761
Member
 
Registered: Jul 2005
Location: San Francisco
Distribution: Fedora Core 6
Posts: 64

Original Poster
Rep: Reputation: 15
Thank you,
You definitely put me in the right direction.....i am newbie to Linux, so sorry if i ask alot of questions.
that looks good, but what command would I issue to print the specfic file and then move it. Would this be a problem if there a multiple files in the watched folder.

Last edited by bhar0761; 07-30-2005 at 03:01 PM.
 
  


Reply


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
Rhythmbox and a folder to watch? fictos Linux - Software 5 11-17-2005 10:35 PM
Can only watch WMV files as root user? insanity101 Mandriva 1 05-04-2005 04:35 AM
How can I watch *.wmv files? kornerr Slackware 4 01-22-2005 12:36 PM
IglooFTP-PRO refuses to upload files in folder when I upload folder eBopBob Linux - Software 0 08-27-2004 05:52 AM
Redirect print output to a folder instead of printer? xmdms Linux - Enterprise 1 07-31-2004 10:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:48 AM.

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