[NTLUG:Discuss] Setting up a watch folder

Fred James fredjame at fredjame.cnc.net
Wed Jan 14 16:31:20 CST 2009


Daniel Hauck wrote:
> This is definitely something I could cobble together on my own but I
> have decided to pose the question here because the answers might be more
> generally educational and because the answers might be better than
> anything I would have considered.
>
> Here's the project:
>
> Users on a small network (3 users total) are using an SME server to host
> their files, their logins and that sort of thing.  They also print
> through this server.  They have an HP600 plotter at their site as well.
>
> Recently, for whatever reason, their ability to send plot files to their
> plotter has broken.  Probably some Windows update has thrown a
> monkey-wrench into the works, but I don't care to fix Windows problems
> and it occurred to me that all we need to do is set up a watch folder
> and let people drag and drop their plot files into the folder and let
> the server do the job of queuing the file and spooling to the plotter.
>
> I have already successfully sent a plot file to the plotter from command
> line, so that functionality is simple and works.  So now I just want to
> set up a "watch folder" that will respond to plot files being present by
> sending them to the plotter and then deleting the file.
>
> I imagine setting up a cron job to run every minute and when it sees a
> file in the folder, it would launch a script that does the work.
>
> How would "you" do it?  I like bash scripting, but perl would be fine...
> or frankly, whatever you like best.
>
> This is the sort of process that could be adapted for all sorts of tasks
> such as image processing or anything else you would like to let a server
> handle in response to a file being copied to a folder.
>   
Daniel Hauck
I am a script fan myself - prefer sh, bash, awk, sed, etc - and I would 
vote for the approach you mention, but I too would like to see what comes up
Regards
Fred James




More information about the Discuss mailing list