WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Firefox downloader and events (Read 4702 times)
Stan
YaBB Newbies
*
Offline



Posts: 20
Firefox downloader and events
Nov 9th, 2009 at 5:14pm
 
I decided to post a new topic, as this might be of interest to more people.

I was having more serious troubles, described elsewhere. Now I'm fiddling heavily with some Upload Files plugin settings, but cannot find a solution for the remaining problem:

Multiple events for Upload Files are fired when downloading a file using Firefox.

Firefox creates a zero-sized file with the target name AND a filename with ".part" suffix, which grows as the file is downloaded.
It's then replaced with the fully downloaded file.

I found no way of telling the Upload Files plugin to ignore files that are 0 (zero) bytes in size! And the event is fired a couple of times until the full file is downloaded, most probably because the timestamp on the zero-file is updated regularly. And I end up sending a zero-sized file several times via FTP  Shocked

As a workaround I introduced heavier delays, but this is slowing me down, and I don't like it as a permanent solution....  Undecided

Regards
Stan
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: Firefox downloader and events
Reply #1 - Nov 10th, 2009 at 9:37am
 
Stan,

This may work: monitor the directory where FF downloads those files, setup a filter ( http://www.watchdirectory.net/wdhelp/help/filter_events.html ) so it will only act when
Extension Equals part
(do not include the dot). Also set it so the task only reacts on FILEDEL events ( http://www.watchdirectory.net/wdhelp/help/wdnewconfigpage4.html ).

Basically, this task will run when a xxxxxxx.part file is deleted. When that happens, the real file (xxxxxxx in this case) is finished downloading.

Set this task to run the following batch script that will move the downloaded file to another directory you can monitor with your "real" task.
Code:
rem just to make sure
if "%WD_REASON%" NEQ "FILEDEL" GOTO :EOF
if "%WD_FILE_E%" NEQ "PART" GOTO "EOF

rem remove the last 5 characters from the filename (remove .part)
SET FI=%WD_FILE:~0,-5%

rem and move this file to its final destination
COPY "%FI%" "C:\SomeOtherDir"
if %ERRORLEVEL% EQU 0 DEL "%FI%"
 



There is a chance FireFox does not DELETE the part file, but instead does this:
DELETE original-name
RENAME original-name.part original-name

In that case you should change the task so it monitors for FILEREN events and change the bat script as follows:
Code:
rem just to make sure
if "%WD_REASON%" NEQ "FILEREN" GOTO :EOF
if "%WD_OFILE_E%" NEQ "PART" GOTO "EOF

rem remove the last 5 characters from the filename (remove .part)
SET FI=%WD_OFILE:~0,-5%

rem and move this file to its final destination
COPY "%FI%" "C:\SomeOtherDir"
if %ERRORLEVEL% EQU 0 DEL "%FI%"
 




Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Stan
YaBB Newbies
*
Offline



Posts: 20
Re: Firefox downloader and events
Reply #2 - Nov 11th, 2009 at 11:06pm
 
Hi Gert,

Thanks for the suggestions.
However, as I wrote in my other thread, I don't really want to move files around that much, as I need the downloaded files to be available to our local users who need to open them, check contents etc.
The automation was supposed to rid them of the routine task of printing every file and sending it to another location.

Now, because of my other troubles, I already move the downloaded files like this:

they download a file to a folder
...\FILES\OrderNo\

after successful FTP upload, the UploadFiles task moves files to a folder
...\FILES_SENT\OrderNo\

then PrintPDF task picks them up and prints them.

And already this setup is causing confusion among the users, as some files disappear quickly from the download folder and, given the daily quantity of files, users don't know if the download was successful and the file got moved, or perhaps they forgot to download a given file, or the download failed, have to re-check, and so on.

So, ideally, I want to come down to a setup, where everything stays in the original folder, and the tasks work 100%.

One would think, that waiting for file availablity would include not only the file size not changing, but also being >0?...

Cheers
Stan

Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: Firefox downloader and events
Reply #3 - Nov 12th, 2009 at 12:19pm
 
Stan,

It is nearly impossible to be compatible with all the different ways files are created, locked etc. I will see if we can add some "file size" filtering in a future release.

Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Stan
YaBB Newbies
*
Offline



Posts: 20
Re: Firefox downloader and events
Reply #4 - May 24th, 2010 at 2:40pm
 
Hi,

I have recently upgraded my installation to the current 4.6.2 version, hoping that it would solve my problems when people download files to a WD hotfolder via Firefox.

Unfortunately, WatchDirectory still picks up zero-sized files that Firefox creates, and transfers them with all the bells and whistles to the destination server  Shocked.

As a consequence, it precludes the actual transmission of the full file (afterwards) from completing, as the FTP UploadFiles plugin is unprepared for such situation, when the destination filename already exists on target server. Explained in detail in my other thread.

Can we count on and option of ignoring zero-sized files soon please?

Cheers
Stan
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: Firefox downloader and events
Reply #5 - May 24th, 2010 at 3:22pm
 
I will see (this means: probably not).
The issue here is that Windows is lying to you. You see a zero byte file in explorer, but in reality it is larger (and growing).
But I recently found some interesting backup interfaces in the Windows API that may help in this case. As simple as this issue seems, it is a hard nut to crack.

Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Stan
YaBB Newbies
*
Offline



Posts: 20
Re: Firefox downloader and events
Reply #6 - May 24th, 2010 at 4:06pm
 
Well, I'm not a low-level system wizard, but what I see is one file called FooBar.pdf for example, and it stays 0-size, and a second file, FooBar.pdf.part, which steadily grows as the download commences.
Once the download finishes, the .part file gets renamed to the original filename.

Much like your ".partial" approach in UploadFiles plugin, but with this "placeholder" file created for God knows what reasons (well, can think of some, actually) at the very beginning.

Frankly speaking, Firefox-related or not, it may be generally useful to have an option not to transmit zero-length files, which may be a result of various system errors elsewhere.
On the other hand, it should be optional, as I can think of reasons to have such files used as kind of "flags" (enabling use of IF EXIST in a batch file for example).

Cheers
Stan
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1