How to Use 'If Then' Condition Based on File Size?

I have a macro that triggers when a video file is added to a specific folder.

I want to carry out a set of actions (Let's call it a Set A) if the file size is less than (or equal to) 2 GB and I want to carry out different set of actions (Set B) if the file size is more than 2 GB.

How to do that?

(The folder exists in such a way that there would always be either 1 file or no file in the folder. There would never be more than 1 file at any time in the folder.)

Try using the Get File Attribute action.

If Fie Size > 2GB....kmmacros (24 KB)

Macro screenshot

It took me about 10 seconds to find "file size" on the wiki...

Search [Keyboard Maestro Wiki]

Limiting the search to actions quickly made the Get File Attribute action the first hit.

1 Like

Usual warning about waiting for the file "addition" to complete before testing file size -- and how you do that will depend on how you are adding it to the folder.

1 Like

Damn it was that easy

I wasn't aware there exists 'get file size to variable' functionality. Let me implement this.

Yes I should have made a search on wiki. I used google and forum only to search.
My bad.

:thinking:

It is going to be a QuickTime Player screen recording that automatically gets saved (by default in Mac in specified folder) so I suppose the entire file would be added rather the partial version first.