Windows 10: How do you search c disk for all the files with the extension txt Solved

Page 1 of 2 12 LastLast
  1.    28 Dec 2017 #1

    How do you search c disk for all the files with the extension txt


    Hello,

    So, I'm looking for quite a detailed search in CMD or RUN (not sure if they are the same), which is searching disk C for all the documents with extension txt also having 150kb. I've got Windows 10 Home if that helps?

    Many thanks
    Mihaela
      My ComputerSystem Spec

  2.    28 Dec 2017 #2

    Welcome to the forum. Open cmd prompt type
    Cd\
    Dir *.txt /s
      My ComputerSystem Spec

  3.    28 Dec 2017 #3

    What Samuria says is quite correct and workable. It's also possible to use a third-party search tool -- I'm a devoted user of Voidtools (Search) Everything tool, which is faster and more capable than built-in Windows search -- to search for *.txt, either on a single drive or some combination of drives.
    HTH,
    --Ed--
      My ComputersSystem Spec

  4.    28 Dec 2017 #4

    Thank you Samuria for the reply and for the welcome ! :)
    Trying to type that in but i get different messages all the time like the syntax it's not correct, like it's not recognized as an internal or external command? Can i kindly ask how exactly should look like?

    Many thanks
    Mihaela
      My ComputerSystem Spec

  5.    28 Dec 2017 #5

    Thank you EdTittel for the reply! I've noted the other program you are using, but unfortunately for this one i will have to use CMD
      My ComputerSystem Spec

  6.    28 Dec 2017 #6

    You can't use Dir or any other commands to list only text files with file size 150kb, you will need to create a batch script to accomplish this task.

    Execute below command to list all text files stored at C: partition and sort the list of text files starting from smallest text files.


    Code:
    Dir  /s  /o:s   C:\*.txt  | more
      My ComputerSystem Spec


  7. Posts : 7,057
    10 Home x64 (1803) (10 Pro on 2nd pc)
       28 Dec 2017 #7

    FreeBooter said: View Post
    You can't use Dir or any other commands to list only text files with file size 150kb...
    Not in a Command prompt, but you can in Powershell. This finds all *.txt files in the current directory or below in the size range 150kb to 300kb.

    Code:
    Get-ChildItem *.txt -recurse | where  {($_.Length) -gt 150KB} | where {($_.Length) -lt 300KB}

    Well, actually you can run Powershell commands in a Command prompt, like this...

    Code:
    powershell  "Get-ChildItem *.txt -recurse | where  {($_.Length) -gt 150KB} | where {($_.Length) -lt 300KB}"

    If you search recursively from the root of the C:\ drive you'll want to supress error messages when trying to access folders you don't have permission for. To do that you should add -erroraction 'silentlycontinue' to your powershell command.

    Code:
    Get-ChildItem C:\*.txt -recurse -erroraction 'silentlycontinue' | where  {($_.Length) -gt 150KB} | where {($_.Length) -lt 300KB}
    Last edited by Bree; 28 Dec 2017 at 18:19.
      My ComputersSystem Spec


  • Posts : 5,704
    Windows 10 Pro X64 16299.192
       28 Dec 2017 #8

    Maybe if you explain exactly what you are trying to do we can be of more help. Why do you need to use CMD prompt or RUN box?

    Bree, when I run the last example you posted, this is what I get:

    Code:
    PS C:\Windows\System32\WindowsPowerShell\v1.0>         Get-ChildItem C:\*.txt -recurse -erroraction 'silentlycontinue' |
     where  {($_.Length) -gt 150KB} | where {($_.Length) -lt 300KB}
    
    
        Directory:
        C:\Users\ztruk\Documents\AppData\Local\Packages\Microsoft.Windows.Cortana_cw5n1h2txyewy\AC\AppCache\ADAOO2L2\101
    
    
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a----       10/30/2015   5:07 AM         272448 C__Windows_SystemApps_Microsoft.Windows.Cortana_cw5n1h2txyewy_cache_De
                                                     sktop_2[1].txt
    
    
        Directory: C:\Users\ztruk\Documents\AppData\Local\Packages\Microsoft.Windows.Cortana_cw5n1h2txyewy\LocalState\Devic
        eSearchCache
    
    
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a----        2/15/2016   9:33 AM         226246 SettingsCache.txt
    
    
        Directory: C:\Users\ztruk\Documents\AppData\Roaming\Roxio
    
    
    Mode                LastWriteTime         Length Name
    ----                -------------         ------ ----
    -a----        4/23/2015  11:23 PM         183934 PlasmaLog.txt
    Get-ChildItem : Access is denied
    At line:1 char:9
    +         Get-ChildItem C:\*.txt -recurse -erroraction 'silentlycontinu ...
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Get-ChildItem], UnauthorizedAccessException
        + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.GetChildItemCommand
    
    
    
    PS C:\Windows\System32\WindowsPowerShell\v1.0>
    PS C:\Windows\System32\WindowsPowerShell\v1.0>         Last edited by Bree; 1 Hour Ago at 06:19 PM.
    At line:1 char:32
    +         Last edited by Bree; 1 Hour Ago at 06:19 PM.
    +                                ~~~~
    Unexpected token 'Hour' in expression or statement.
        + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : UnexpectedToken
    
    PS C:\Windows\System32\WindowsPowerShell\v1.0>
    PS C:\Windows\System32\WindowsPowerShell\v1.0>       My ComputersSystem Spec
    My : The term 'My' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
    spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:7
    +       My ComputersSystem Spec
    +       ~~
        + CategoryInfo          : ObjectNotFound: (My:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    
    PS C:\Windows\System32\WindowsPowerShell\v1.0>     Quote Quote   Multi-Quote This Message
    Quote : The term 'Quote' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
    the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:5
    +     Quote Quote   Multi-Quote This Message
    +     ~~~~~
        + CategoryInfo          : ObjectNotFound: (Quote:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    Why am I getting the errors, other than Access Denied, those I understand.
      My ComputersSystem Spec


  • Posts : 7,057
    10 Home x64 (1803) (10 Pro on 2nd pc)
       28 Dec 2017 #9

    Ztruker said: View Post
    Bree, when I run the last example you posted, this is what I get:

    Code:
     .....
    PS C:\Windows\System32\WindowsPowerShell\v1.0>
    PS C:\Windows\System32\WindowsPowerShell\v1.0>         Last edited by Bree; 1 Hour Ago at 06:19 PM.
    At line:1 char:32
    +         Last edited by Bree; 1 Hour Ago at 06:19 PM.
    +                                ~~~~
    Unexpected token 'Hour' in expression or statement.
    ...
    PS C:\Windows\System32\WindowsPowerShell\v1.0>       My ComputersSystem Spec
    My : The term 'My' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
    spelling of the name, or if a path was included, verify that the path is correct and try again.
    ...
    ...
    PS C:\Windows\System32\WindowsPowerShell\v1.0>     Quote Quote   Multi-Quote This Message
    Quote : The term 'Quote' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
    the spelling of the name, or if a path was included, verify that the path is correct and try again.
    ...
    Why am I getting the errors, other than Access Denied, those I understand.
    Finger trouble - you appear to have accidentally pasted more than just the command (looks like the rest of the post got copied too). :)
      My ComputersSystem Spec


  • Posts : 5,704
    Windows 10 Pro X64 16299.192
       29 Dec 2017 #10

    Must have, sorry. Did it again and ran in the Powershell ISE and it worked great.
      My ComputersSystem Spec


  •  
    Page 1 of 2 12 LastLast

    Related Threads
    Please allow me to explain my problem for it to be better understood. Approx. three weeks ago my computer just suddenly shut down. Within a few seconds I was receiving a display that said Windows will repair your computer and reinstall Windows. I...
    Hi everyone, I'm running a fresh install of Windows 10 Pro on an XPS 13. I was convinced that search was broken, but it turns out my files WOULD show if I provided a filter. For example: Hit Windows key and type "Beatles" and I would only...
    Hello, So I practically have most of my folders that contain all types of files set up for the Details view setting. (if you right click in a folder -> View -> Details) I set all those adjustments through the Folder Options window. Yet when...
    Search in certain files in General Support
    Hi, how can i search within the content of only certain files ? Also, is there a page that contains the list for all Win10 search functions ? I'm looking it up since 30 minutes but can't find anything. I need to seach the term blabla in all...
    Ok Here is the thing, I recently upgraded to windows 10 and every works find except that 100% disk usage thing. Two programs take all the disk resources which are "System" and "Service host local system". I literally tried everything on the...
    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 09:04.
    Find Us