Trigger to Monitor changes in a folder

macro8684

New member
Hello,
A Trigger that goes off when it detect any changes in a particular folder will be great to copy, move, organize photos or other files.

Something like this in tasker.
 

FrameXX

Well-known member
There's no direct trigger for the change in folder, but if you don't need MacroDroid to trigger immediately after the change is detected in folder and you are ok with some small delays of that desired actions you could run some checks every 10 minutes or so.

By checks I mean shell commands that would save the file paths in the specified folder into the string. I am not familiar with linux file commands but after a while I created this:
Bash:
find /storage/emulated/0/Download/ -name *
(I recommend checking the option to use MD helper just for sure that MacroDroid has access.)

It outputs all file paths of files with any name (that means all files literally) in Download folder in internal storage into a string. There is no separator between the file paths but I used /storage/emulated/0/Download/ as a separator and with Text manipulation action separated the remaining file names into an array (In case I had a subfolders in my Download folders the subfolder would of course stay with the file name like: AMD/video.webm (This could be removed with regex.)).

Or if you still don't trust MacroDroid arrays (which I wholly understand) you can just replace the path to Download folder with another separator like ; or similiar.

Now you can use whatever constraints, loops, actions or what you come with to make different actions on different cases of output.
 
Last edited:

macro8684

New member
There's no direct trigger for the change in folder, but if you don't need MacroDroid to trigger immediately after the change is detected in folder and you are ok with some small delays of that desired actions you could run some checks every 10 minutes or so.

By checks I mean shell commands that would save the file paths in the specified folder into the string. I am not familiar with linux file commands but after a while I created this:
Bash:
find /storage/emulated/0/Download/ -name *
(I recommend checking the option to use MD helper just for sure that MacroDroid has access.)

It outputs all file paths of files with any name (that means all files literally) in Download folder in internal storage into a string. There is no separator between the file paths but I used /storage/emulated/0/Download/ as a separator and with Text manipulation action separated the remaining file names into an array (In case I had a subfolders in my Download folders the subfolder would of course stay with the file name like: AMD/video.webm (This could be removed with regex.)).

Or if you still don't trust MacroDroid arrays (which I wholly understand) you can just replace the path to Download folder with another separator like ; or similiar.

Now you can use whatever constraints, loops, actions or what you come with to make different actions on different cases of output.
I understand, i can do it with manually checking for changes with bash command or termux script.
But I wanted something integrated in Macrodroid natively.

Thank you for reply.
 
Top