From: Brian Wallace Date: 2009-04-21T14:03:38+09:00 Subject: directory watcher, trying to match filename to directory name. --000e0cd69770bae7180468097b12 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi All, Here's an issue I can't seem to figure out, regardless of the hours i've spent pondering it... I'm using Directory Watcher to scan a directory for added files, if files are added I run my method that handles them.. This works great... However.. I'm trying to match the directory name to the file name , ie: C:\Send\Bob\Bob* will trigger the event ,but any other file added to that directory will not ... here's what I have - this will just fire an event for any file added to the observed folder. I set a directory , such as "C:\Send" and then only monitor the subdirectories of this directory .. I just need to make sure that events are fired _only_ when the subdirectory name matches the beginning of the file name. dw = DirectoryWatcher.new "#{@dirwatch}", :interval => 5, :glob => "*/*", :pre_load => true dw.add_observer {|*args| args.each do |a| if a.type == :added sleep(3) @filename = a.path signInAction() getFile(@filename) initDataUpload(@localFileSize, @session) completeSend(@fileId, @session) addDelivery(@localFile, @fileId, @session, @rcpt_email) puts "File: #{@filename} sent!!!" @chunkSize = 61440 end end end} Any Ideas? Thanks, Brian --000e0cd69770bae7180468097b12--