Get Hazel to wait until file has downloaded

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Get Hazel to wait until file has downloaded Wed Jul 11, 2012 7:13 am • by tone
Hi,

I've got Hazel watching a folder and doing different things depending on the type of file it finds. However, if I download a large file to that folder, Hazel will process it before it's finished downloading, which never ends well.

Is there any way to make Hazel wait until the file's downloaded?

Cheers,
tone
tone
 
Posts: 18
Joined: Sun Jun 12, 2011 6:02 pm

What program is doing the downloading? Hazel can detect this for some programs but it requires some cooperation from the program downloading the file.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

There are a few things that could be going on here.

First, Hazel by default tries to ignore common partially downloaded files (e.g. *.part, etc.)

First, what browser/application are you using to download files? Modern browsers will lock a partially downloaded file so that Hazel will ignore it.

Are these file always the same type?

Does your browser/application have the option to move completed downloads? If so, why not select a download and a complete directory.

Once we have more information, then we can devise a strategy to help your case.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Get Hazel to wait until file has downloaded Wed Jul 11, 2012 1:20 pm • by tone
Thanks for the replies. I'm typically downloading documents (PDF or DOC) in Firefox. If it's a DOC, Hazel sends it off to the CUPS-PDF printer, and then another rule imports the resulting PDF to Papers (document manager). If it's a PDF, Hazel is supposed to import it to Papers directly, and this is where it happens before the document has downloaded.

I don't think FF can move completed downloads out of the box, but perhaps there's a plugin for that.
tone
 
Posts: 18
Joined: Sun Jun 12, 2011 6:02 pm

With Firefox, it's odd in that it is inconsistent. There are times where it does not put the .part extension at the end of a file. It's something which I find annoying and filed a bug with them years ago but I guess it's still happening. To minimize it, make sure in Firefox's preferences to set a download folder and always use that mechanism to download files (do not save to a folder).
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Get Hazel to wait until file has downloaded Fri Jul 13, 2012 9:07 am • by tone
Mr_Noodle wrote:With Firefox, it's odd in that it is inconsistent. There are times where it does not put the .part extension at the end of a file. It's something which I find annoying and filed a bug with them years ago but I guess it's still happening.


That is annoying. I'll see if I can follow up with another bug report.

Mr_Noodle wrote:To minimize it, make sure in Firefox's preferences to set a download folder and always use that mechanism to download files (do not save to a folder).


Thanks for the tip. However, one of the reasons I don't use Safari as my main browser is that it doesn't let you to choose where to save each download. Having to move files from the Downloads folder to where you want them kind of defeats the purpose of Hazel.
tone
 
Posts: 18
Joined: Sun Jun 12, 2011 6:02 pm

Well, you could argue, having Hazel move files from Downloads is the point of Hazel. If you are consistently doing this for DOC and PDF files, then why not just send them to Downloads and have the rules in there to process them?
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Get Hazel to wait until file has downloaded Fri Jul 13, 2012 4:38 pm • by tone
Mr_Noodle wrote:Well, you could argue, having Hazel move files from Downloads is the point of Hazel. If you are consistently doing this for DOC and PDF files, then why not just send them to Downloads and have the rules in there to process them?


To give an example, sometimes I want my PDFs to go to Papers and other times I want them in (say) Evernote, and I save them to different folders for Hazel to do her thing.
tone
 
Posts: 18
Joined: Sun Jun 12, 2011 6:02 pm

tone wrote:
Is there any way to make Hazel wait until the file's downloaded?


Have you tried to apply a rule like "If FileX hasn't been modified for 3 minutes then ruleY"?

Basically a file that is being downloaded changes the modification date constantly and it's kind of an indicator that the download is finished when there are no more modifications. This should work for you.
pattulus
 
Posts: 13
Joined: Sun Nov 06, 2011 1:05 pm

Re: Get Hazel to wait until file has downloaded Wed Jul 18, 2012 1:07 pm • by tone
pattulus wrote:
tone wrote:
Is there any way to make Hazel wait until the file's downloaded?


Have you tried to apply a rule like "If FileX hasn't been modified for 3 minutes then ruleY"?

Basically a file that is being downloaded changes the modification date constantly and it's kind of an indicator that the download is finished when there are no more modifications. This should work for you.


Thanks for the suggestion, which works as you say. I had tried something like that before, but I decided not to use it because it means having to wait a minimum of 1 minute for Hazel to process the document. If it were possible to create a rule like "If FileX hasn't been modified for 5 seconds then ruleY", then I'd use this approach.
tone
 
Posts: 18
Joined: Sun Jun 12, 2011 6:02 pm

Does the folder that the rule is watching modification change if an applescript is opening up files in it (the folder) & saving new pdf's into it? & can we get hazel to watch the folders modification time & then wait to run the rule until after the folders modification stops changing?
brianedl
 
Posts: 26
Joined: Tue Jun 05, 2012 10:08 am

How would it know when it stops changing? Also, it's not a good general solution. Just because one file is busy in that folder doesn't mean that Hazel should ignore all the others ones in there that can be processed.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

This would be a good rule for some of my watched folders because I have an applescript running several files in the folder as a batch then when the batch of files is complete it pushes them forward. The applescript works on a whole batch 1st then moves batch forward when done because we have this on a network & I maybe processing a batch of files & while they are processing someone else on the network may send a batch of files to be processed & the applescript will be able to work the next batch of fills when present batch is finished & so on. So I was hoping to have some way in Hazel to wait to run some rules after the folders modification stops changing or I don't know the size of the folder stops changing for a few seconds or something to know when files are ready?

I also have a Growl message sent to me if certain files are copied into the folder but do not have a certain label color (That would mean that rules before the rule to change label color did not happen & then send me a Growl) well the files get copied into the folder then change color label but what happens is it sends the Growl message just before the label color changes.

Do you have any Ideas?
brianedl
 
Posts: 26
Joined: Tue Jun 05, 2012 10:08 am

Have you tried the previous suggestion of doing something like "Date modified is not in the last X minutes"? You have to determine what is a safe amount of time since it depends on your situation.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hello,
I'm not waiting for my file to be downloaded but for my scanner to finish it's job. Unfortunately, it is starting to write the output file right away.
Since the scanning is a matter of seconds and not minutes, I'd like to set the check for the "Date last modified" not to minutes but to seconds.
Unfortunately, the UI doesn't allow that. (even though Unix stores the file modification timestamps with seconds, if not milliseconds, if I remember right).
Any chance, that in future versions of Hazel checking for seconds will be included?

Thank you so much,
bullitt168
bullitt168
 
Posts: 1
Joined: Thu Mar 07, 2013 5:23 pm

Next

Return to Support