B
Brian Wallace
[Note: parts of this message were removed to make it a legal post.]
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 => "*/*",
re_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
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 => "*/*",
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