How Do I Check Conditions Before Saving Files In Subfolder?

Hi Again,

I am trying to check that my files (PDF) are complete before saving them in a subfolder with the respective name, the files are always composed of the same structure, for example:

21574736 Firma
21574736 Hc
21574736 RIAS Orden
21574736 Orden

21574736 is a variable. I do the automatic renaming process of these PDFs with Hazel.

I understand that with Hazel I can make them organize by folder but not check that these 4 complete files are there before.

2 Likes

I ran into a similar situation recently where I was downloading a file and I wanted the macro to wait until the file showed up. In my macro subroutine I ran a shell script that returned the number of files in that directory and then I kept checking until the file count increased to the expected number. You could easily modify the subroutine to wait for multiple files to fit your use case.

Macro subroutine image

SUB - Watch for new file in folder - return file name.kmmacros (24.9 KB)

There are probably even better ways that other more experienced will know about but this is what I came up with at the time.

Are these downloads (and, if so, downloaded by what)? Network copies? Being created locally with Distiller or similar? Or potentially "incomplete" for some other reason?