Trigger Folder Monitor on folder creation?

This Forum is for the use of End Users requiring help and assistance for Tracker Software's PDF-Tools.

Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Stefan - PDF-XChange

Post Reply
involve39
User
Posts: 17
Joined: Thu Aug 29, 2024 10:04 am

Trigger Folder Monitor on folder creation?

Post by involve39 »

Hi,

I would like to trigger a Folder Monitor when a new folder is created inside its watch folder.
As far as I can see, that isn't currently supported, is it?

Use case:
I'm processing email attachments, where one email corresponds to one folder. All the email's attachments are saved into that folder, which is then dropped into the Folder Monitor watch folder.

All attachments of a specific email have to be handled as a "package", and not individually - meaning the Folder Monitor must only trigger once for each new folder created in the watch folder.
So I can't just use any random file as the trigger, because some messages have multiple attachments, causing the Folder Monitor to trigger more than once for this email (folder).

If I were certain that each email has exactly one attachment of a certain type (e.g. xlsx), then I could use that as a filter for the Folder Monitor. Unfortunately, that is not the case.

Are there any workarounds to achieve this?
Thanks!
User avatar
DenisO
Site Admin
Posts: 116
Joined: Fri Jun 09, 2017 5:40 pm

Re: Trigger Folder Monitor on folder creation?

Post by DenisO »

Hi,
Which version of PDFTools do you use? Use case you described should trigger current folder monitor.
Denis Oleksenko
Software Developer
Tracker Software Products (Canada) LTD
involve39
User
Posts: 17
Joined: Thu Aug 29, 2024 10:04 am

Re: Trigger Folder Monitor on folder creation?

Post by involve39 »

Hi,

thanks for your reply!

Maybe I'm missing something, but I don't see a way to achieve this.

The Available File Filters dialog only allows me to select various sorts of file types.

I can set the custom filter for the folder monitor to *.* and disable the Monitor subfolders option. But that will only trigger when a new file is created in the watch folder, and not for a new folder (regardless whether that folder contains any files or not).

I'm using version 10.4.1.389.
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 10880
Joined: Wed Jan 03, 2018 6:52 pm

Re: Trigger Folder Monitor on folder creation?

Post by Daniel - PDF-XChange »

Hello, involve39

If you are wanting to include new subfolders, you would need to leave "monitor subfolders" enabled. After that, move the whole folder and its contents as one into the location. Tools should process all of those files in a group.
With that said, it sounds like you need to run this action on demand so a monitor is not likely the best choice, If your hard drive is slow, or windows struggles to move one of your documents in time, a monitor could kick in and start processing all the other files, before the last one or two are in place.

I would instead recommend that you manually run the tool, instead of using a monitor for the task. This would allow you to ensure all the requisite content is already present in the source folder, before running the tool. And it would allow you to have active control of the output location, if needed.

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
DenisO
Site Admin
Posts: 116
Joined: Fri Jun 09, 2017 5:40 pm

Re: Trigger Folder Monitor on folder creation?

Post by DenisO »

So does the folder monitor trigger if you drop new folder with files ?
Denis Oleksenko
Software Developer
Tracker Software Products (Canada) LTD
involve39
User
Posts: 17
Joined: Thu Aug 29, 2024 10:04 am

Re: Trigger Folder Monitor on folder creation?

Post by involve39 »

Thanks for your reples!
DenisO wrote: Thu Oct 03, 2024 11:54 pm So does the folder monitor trigger if you drop new folder with files ?
Yes, this works fine :)

TrackerSupp-Daniel wrote: Thu Oct 03, 2024 4:01 pm With that said, it sounds like you need to run this action on demand so a monitor is not likely the best choice, If your hard drive is slow, or windows struggles to move one of your documents in time, a monitor could kick in and start processing all the other files, before the last one or two are in place.
Luckily, the files aren't that big, since they arrived via email. But I do have some small delays built into the workflow to avoid this sort of "race condition".
TrackerSupp-Daniel wrote: Thu Oct 03, 2024 4:01 pm I would instead recommend that you manually run the tool, instead of using a monitor for the task.
I'd really prefer to have it automated :D

For the time being, I'm using a workaround to make sure that the folder monitor kicks in exactly once for each new subfolder: I create a special, unique file in each subfolder that serves no purpose other than to trigger the folder monitor.

While this does the job, it's not very elegant and I have to educate users not to delete the trigger file, if they happen to see it.
I've tried setting the trigger file to hidden, but then folder monitor doesn't detect it either and therefore doesn't run.
User avatar
DenisO
Site Admin
Posts: 116
Joined: Fri Jun 09, 2017 5:40 pm

Re: Trigger Folder Monitor on folder creation?

Post by DenisO »

Could you please clarify what do you expect from Monitor.

If I drop folder with files then Monitor triggers and and tool processes them only once. Works as expected.
But what do you expect if folder is empty?
Denis Oleksenko
Software Developer
Tracker Software Products (Canada) LTD
User avatar
Vladimir G - Tracker Dev
User
Posts: 68
Joined: Thu Nov 30, 2017 1:24 pm

Re: Trigger Folder Monitor on folder creation?

Post by Vladimir G - Tracker Dev »

Hello, involve39,

We are a bit confused about the root issue you're experiencing. Let me ask a few questions to clarify the situation:

  • Do the subfolders already exist when new files are copied into them, or are you copying/moving the subfolders containing files from a location outside the Monitor Folder?
  • In the workaround from your last message, when you create the trigger file, are there other files already in the folder? Previously, you mentioned that the Folder Monitor triggers on new files in a subfolder. So what is the purpose of the trigger file, considering that the Folder Monitor does not distinguish it from other files in the subfolder since you have the *.* file filter selected?
  • At one point, you mention that the Folder Monitor triggers on files in the subfolder, but at another, you say you have to create a trigger file. Could you clarify this?
  • Can you describe the process of saving email attachments into the subfolders of the Monitor Folder? Is the copying done manually or with some kind of script?
Additionally, I'll make a few comments about your workflow:
Unfortunately, the Folder Monitor feature was not designed to process files from each subfolder of the Monitor Folder separately. This is why you need to enable the "Monitor subfolders" option. In the end, all files from the Monitor Folder and its subfolders that match the File Types filter will be processed with the tool specified for the Folder Monitor.

So, if you want to process the subfolders separately, you would either need to:
  • Run the tool manually for each subfolder.
  • Use a script that run /RunTool CLI command for files from each subfolder.
  • Create separate Folder Monitors for each subfolder, which I assume is not an option for you.
In any case, I believe it's difficult to guarantee that the Folder Monitor won't start processing files in the middle of their copying/moving process.

Best regards,
Vladimir Goshko
Software Developer
PDF-XChange Co. LTD
Post Reply