How can I select specific files by name in a folder ?


  1. Posts : 317
    Windows 10 Home
       #1

    How can I select specific files by name in a folder ?


    Okay thanks in advance of this .
    I have a list of lets say 10 file names.
    They are in a text file.

    I want to search a folder that has those file names, highlight and then i guess, reverse the highlight to all other files in that folder, so i can delete the other files, but preserve the names in this list i have.

    Not sure how would i go about this. Or just at least, highlight cut these files ; by this name list, so i can paste
    separate them into a different folder ; and delete all remaining files in the folder they were at. i know a bit wordy. im tried : ).


    i have a software called Everything , by voidtools. im unsure if it can search muti names at once. then i could sort by path, and just cut and paste them .
      My Computer


  2. Posts : 869
    Windows 10 Professional x64 21H2
       #2

    I got your PM. If you're using Everything I suggest you use the links I posted. Everything is a complex search engine and you'll find better results buy accessing the...
      My Computers


  3. Posts : 989
    Microsoft Windows 10 Home
       #3

    If you want this semi-automated, as you describe, rather than fully scripted, this bit of PowerShell could help. Assuming your text file looks like this:
    Code:
    FIle1.txt
    FIel2.pdf
    FIle3.csv


    and you Select All then copy to Clipboard. Then this code will take the Clipboard contents, create a search string that excludes those files, and copies that string to the Clipboard.

    Code:
    "FileName:NOT $(((gcb) -ne '') -join ' NOT ')" | scb

    Produces the search string: FIleName:NOT FIle1.txt NOT FIel2.pdf NOT FIle3.csv

    You can then paste that into the Search box of an Explorer window open to the folder containing the files.

    This action could be accessed by a shortcut with the following target:
    Code:
    PowerShell -Command "'FIleName:NOT {0}' -f (((gcb) -ne '') -join ' NOT ') | scb"
      My Computer


  4. Posts : 317
    Windows 10 Home
    Thread Starter
       #4

    KeithM said:
    If you want this semi-automated, as you describe, rather than fully scripted, this bit of PowerShell could help. Assuming your text file looks like this:
    Code:
    FIle1.txt
    FIel2.pdf
    FIle3.csv


    and you Select All then copy to Clipboard. Then this code will take the Clipboard contents, create a search string that excludes those files, and copies that string to the Clipboard.

    Code:
    "FileName:NOT $(((gcb) -ne '') -join ' NOT ')" | scb

    Produces the search string: FIleName:NOT FIle1.txt NOT FIel2.pdf NOT FIle3.csv

    You can then paste that into the Search box of an Explorer window open to the folder containing the files.

    This action could be accessed by a shortcut with the following target:
    Code:
    PowerShell -Command "'FIleName:NOT {0}' -f (((gcb) -ne '') -join ' NOT ') | scb"
    This is interesting but complicated for me having never done this it looks foreign to me .
    And, yes i would want this automated because i can see myself doing this taste repeatedly through the year or two to come . Like a automated .Bat file . i had made bat files in the past ( with alot of help from this forum ) to rename equal number of files in a folder, from the names of files in a different folder in the same location. I had since lost that bat file since I had a system failure and lost all my files. That being one of the best bat files i had sadly its gone .and most of the evidence online is lost . stack overflow deleted my account i had much of that info at .anyway .

    I'll try powershell suggestion in the coming days i suppose. thanks alot .
      My Computer


  5. Posts : 43,024
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #5

    If you wish to exclude folders from the result (for some reason file:<name> and filename:<name> also include matching folders in the result) try e.g. this in this order

    file:cable OR file:dubrovnik NOT kind:folder

    This ensures files matching cable or dubrovnik are listed, but no folders that might match cable or dubrovnik
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 00:47.
Find Us




Windows 10 Forums