How do I search specified text in files on my Mac that are less than 20kb?

I created an SVG image a few months ago.

Recently I found the file is lost, but I don't think I deleted it.

I need to know how can I find this file by setting up these filters:

  1. only search for files that were created in the past 8 months.
  2. only search for files that are less than 20kb.
  3. search keywords "XXXX" (which I am sure is in that file) that existed in these qualified files.

Is there any way I can do this? Any solution is welcome.


A simple Finder Spotlight search can do this. Navigate to the Folder you want to start the search from. Type Command F, and then enter the search criteria:

enter image description here

I'm not sure what you mean by keywords: do you mean metadata describing the file, or some actual text in the SVG? You could try the "Contents" token for the latter.


You can use Find Any File app as seen below https://apps.tempel.org/FindAnyFile/index.php

enter image description here


Try this from terminal also if you want to get a file of search in txt too:

 find . -name '*.svg' -type 'f' -size -20k -newermt 2019-04-23 -not -newermt 2019-12-28 > findlist.txt

Note: the - before 20k. Just 20k means exactly 20 kilobytes. -20k means smaller than 20 kilobytes. +20k means larger than 20 kilobytes.

The -type 'f' forces the command to only act on files and skip directories. this would avoid errors if the path contains folders with names that match the pattern *.svg.

If you want to filter size in bytes (as in 20 bytes instead of 20 kilobytes) then you have to write it like this: 20c. If you just write 20 it will be interpreted as 20*512 bytes. This is a strange requirement by POSIX.