Pause Folder Scans

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

Moderator: Mr_Noodle

Pause Folder Scans Mon Aug 26, 2024 9:03 am • by laurie_lewis
Hi,

I am trying to find an elegant way to achieve a staged folder processing process. I have multiple folders with rules that work but I need them to stop processing if another folder is being processed.

Folder A: - Master sorting Folder. If there are file here other relevant folders should not process
Folder B: - This folder should process after Folder A has finished
Folder C: - This folder should process after Folder B has finished
Folder D: - This folder should process after Folder B has finished

Files only get put into Folder A. Can be a couple or can be thousands. After that everything is automated. Apart from me having to pause/resume folder rules.

So this is what I have so far. Folder A this is the first rule that creates a trigger file.

Create Trigger file
If a file does not exist (checks with shell script)
Subfolder Depth is 0
Sub-File/folder count is 0
then
Run shell script to create the file

Shell Scripts used.

Code: Select all
#!/bin/bash
# Checking that file does exist
if [ ! -f "/Volumes/Photo-Working/Auto-Sort-Files/UnSorted-Photos-Movies/Pause-Other-Rules.tmp" ]; then
     exit 0;
fi
exit 1;
/code]

[code]
#!/bin/bash
touch /Volumes/Photo-Working/Auto-Sort-Files/UnSorted-Photos-Movies/Pause-Other-Rules.tmp
[/code]

LOTS OF OTHER RULES

Delete Trigger File
  If file exists
  Subfolder Depth is 0
  Sub-File/folder count is 1
then
  Move trigger file to trash

I then have as the first condition of each rule of Folder B

Passes shell script

[code]
#!/bin/bash
# Checking that file does exist
if [ ! -f "/Volumes/Photo-Working/Auto-Sort-Files/UnSorted-Photos-Movies/Pause-Other-Rules.tmp" ]; then
     exit 0;
fi
exit 1;


I was then going put in a rule to create another file in folder B as I did for Folder A for when the rules of Folder B are being processed. First problem is that I am not sure on how to delete it after the folder has been fully processed. There will still be files in that directory/sub directories.

Finally for Folders C/D/etc all their rules would have a condition that the trigger file in Folder B should not exist. They will only get their files from Folder B processes.

I am also assuming that I may have to add a touch command into the process that deletes the trigger files to reinstate a scan of the folders as Hazel may have gone through all the files finding no matches due to the condition of the non existence of the trigger files. Again not sure here.

This is all sounding very complicated and it is doing my head in.

I could not find a way to pause/stop folder rules being processed via Apple Script which would be the easiest way. Great if someone could tell me that I missed that.

Hopefully someone can point me in the correct direction.

Thanks
laurie_lewis
 
Posts: 23
Joined: Thu Mar 14, 2013 11:53 pm

Re: Pause Folder Scans Mon Aug 26, 2024 12:01 pm • by Mr_Noodle
So even if folder B is finished, there are still files in there? How do you, as a human, know when it's finished processing?

You can pause folders via AppleScript though not sure if that's the best way to go about doing this.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Pause Folder Scans Tue Aug 27, 2024 1:18 am • by laurie_lewis
So as a human I use the highly technical system of leaving it for a long time, checking that there is no disk activity light going and then looking at the logs to make sure nothing is happening. Then hope for the best I suppose. :D :D

OK - I need to add at least another move in.

I will try and look at the AppleScript again to see if I can figure that out.
laurie_lewis
 
Posts: 23
Joined: Thu Mar 14, 2013 11:53 pm


Return to Support