Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Collection based on file existence?

I've created a dynamic collection based on the Files section, using the field Path and this is set  to Equals = c:\folder1\file2.txt so that's ready to go.

However, i'm struggling to figure out how to setup my scan profile for files? I have unticked "all disks" and in that field I have just put "c" do i need c:\ for example? I have then unticked "all sub-directories" and put in there \folder1\ ... 

Is that the correct way? Could someone put the correct settings in for the scan profile to scan c:\folder1 and pop up the screenshot?

Thanks

0

Comments

12 comments
Date Votes
  • James,

    Good question, the window isn't perfectly clear.  If you're looking for a single file called c:\folder1\file2.txt you would set it up this way:

    filescanner.png

    "Root Directory" is where the scan will start.  "All Sub Directories" means that the scan will include the "Root Directory" and all directories underneath it.  "File Patterns" is the name, or wildcard, used to include files in the scan. 

    In your case you want to start at c:\folder1 and only get a file called file2.txt.  You could get all .txt files by adding *.txt to "File Patterns".  

    0
  • Answered my question perfectly, now works a treat. Thank you very very much for your superb support, second to none! 

    0
  • You're welcome, glad to help.

    0
  • Adam,

    In any collection, when you right click on a computer and click Scan Computer (or hit F6) which scan profile runs by default?

    0
  • The default scan profile is "Standard".  You can change to a different profile in the preferences by selecting the profile and clicking "Set Default".

    0
  • Excellent ... last question I promise. Is there a scan profile / collection query that can just check for a directory such as C:\folder1 rather than a file within there?

    So if c:\folder1 exists then that goes in to a collection?

    0
  • Unfortunately, not at the present time, the scanner only looks for files.  We are planning on allowing this in the future.

    There is a partial workaround, though, which you can use now. Put * in the "File Patterns" and set the "Row Limit" to 1.  You can then base the collection on the file path and ignore the file name.  This will only work if the directory isn't empty, but it should get you partway there.

    0
  • Ok I have a situation very close to this.  I have created a scan that looks for a file located at the Root of C: a text file that I have PDQ Deploy placing there after a MS Hotfix application.

    The Scan works and works on schedule.  But the Dynamic collection is working backwards.  If I set it up to look for:
    File - Path - Does not equal -  C:\msformsfixed.txt 

    It will give me the list of computers that have the msformsfixed.txt file.  But I can not figure out how to get the list of computers that do not have that file.  Any ideas?

     

    Thanks

    MIke

    0
  • Change the Group Filter to Not All.

    0
  • Hi Mike,

    Colby's response is great. The results you are seeing are actually accurate for the query being passed though they aren't what you are expecting. What your query is asking is "show me all computers that have files that aren't called msformsfixed.txt". Any computer that has a file that isn't called msformsfixed.txt would be displayed. This is due to the One to Many relationship that exists between the Computer and Files tables.

    To add to Colby's suggestion you can also try modifying the collection filters like the example below. Note the Group Filters. The second group filter looks for all computers that HAVE this file and then flips the results (NOT ANY) to only return computers that don't have a file in that path called msformsfixed.txt.

    It's not incredibly intuitive but it is necessary when dealing with databases and the different relationships between tables.

    FileScannerCollections.png

     

    0
  • Hey there, thanks for the replies,

    I tried switching it to not any and still don't get any results.  Here is the custom scan I perform.

     

    and here are my settings for the Dynamic Collection

     

    But I still get zero results....I have ran the scan on all of the computers, ensuring that only three of them have the text file c:\msformsfixed.txt

    Am I missing something??

    THanks

     

    0
  • OK I got it to work, here's what I had to do to the Dynamic Collection to display the machines that do not have the file.
    I have the group filter set to Not any, and the filter value set to File - name - Does Not Equal - C:\msformsfixed.txt

    Now the results show only the machines that are missing the file. 

    Weird but it works.

    1