Posts: 1,225
Threads: 283
Joined: Jul 2022
I need to monitor files inside a folder named
T on the desktop.
If I drag and drop a folder named
A (which contains a file named
A.txt) into the
T folder, the trigger does not work. Nothing is displayed in the Output panel, and neither the trigger type nor the file path is reported.
The following video demonstrates the issue.
Posts: 12,291
Threads: 144
Joined: Dec 2002
1. QM bug - somehow file triggers don't work when the filename length is < 3.
2. QM triggers use the logic of the used Windows API. When a folder added, we have a notification for that folder only, not for files in it. Workaround: Let the script trigger include all files and folders; then enumerate files.
Function
File_trigger_files_in_added_folder
Trigger
$f 0xC07 "C:\Test"
;\
function event $name [$newname]
;event: 1 added, 2 removed, 4 renamed, 8 modified
out F"{event} {name}"
if event=1 ;;added
,if FileExists(name 2)=2 ;;folder
,,Dir d
,,foreach(d F"{name}\*.txt" FE_Dir 4) ;;enum descendant txt files
,,,str path=d.FullPath
,,,out path
,,
,,
Posts: 1,225
Threads: 283
Joined: Jul 2022
06-07-2026, 09:36 AM
(This post was last modified: 06-07-2026, 09:37 AM by Davider.)
Thanks for your help.
I tested the trigger code above, but it still doesn't work.
Posts: 12,291
Threads: 144
Joined: Dec 2002
The trigger is changed too, not only code.
Posts: 1,225
Threads: 283
Joined: Jul 2022
07-04-2026, 12:25 AM
(This post was last modified: 07-04-2026, 12:25 AM by Davider.)
Thanks for your help. After restarting QM, the settings took effect.
Also, I need the trigger to fire only after all files in the target folder have finished copying. Is there a simple way to achieve this?
For example:
I copy a folder named "ABC1" into the folder C:\Test. The "ABC1" folder contains several files, each hundreds of MB in size, so it takes some time for all files to finish copying to the destination folder.
I want the trigger to fire only after all files have been completely copied, and then output the folder path and file paths.
Posts: 12,291
Threads: 144
Joined: Dec 2002
07-04-2026, 05:03 AM
(This post was last modified: 07-04-2026, 06:17 AM by Gintaras.)
Does the file-trigger script know the path of the copy-source folder? Then we can make the script better. But it can't be used when *moving* instead of *copying*.
In any case can't make this 100% reliable. And the code isn't easy to create. Need to manage multiple "file change" events. Possibly slow.
If possible, instead use a script (eg cmd, PowerShell or QM) that copies files and then launches a QM macro. Then don't need a file trigger + code to wait until all files completely copied.
Posts: 1,225
Threads: 283
Joined: Jul 2022
Sorry, I forgot to mention one detail: in actual use, `C:\Test` is located in a shared folder, and the `ABC1` folder is copied into that shared folder from another computer.
Posts: 12,291
Threads: 144
Joined: Dec 2002
07-04-2026, 08:20 AM
(This post was last modified: 07-04-2026, 05:15 PM by Gintaras.)
Can't know when the copying operation ended.
Maybe after copying files the remote computer can execute a process (start a QM macro) on the shared computer? Eg using PsExec or WMI or PowerShell or schtasks. Then would not need file triggers. Or after copying make an extra filesystem change (create/delete/rename/attributes/etc) and use it for the file trigger.