Here is an old example I created back in 2015, to populate a collection based on devices who have a folder present. As apart of the migration to this new blog- it has been reposted here.
Ever had the need to create a SCCM collection based on if a folder exists on a system?
Well, its quite easy.
Under Criteria, Select Software Files.
Select your Value as File Path
Remember to use your wildcard! “%”
The end query will resemble this:
select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client
FROM SMS_R_System inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceId = SMS_R_System.ResourceId
WHERE SMS_G_System_SoftwareFile.FilePath LIKE "C:\\Temp\\%"