Powershell script to count file types


  1. Posts : 1
    Windows 7 64 BIT
       #1

    Powershell script to count file types


    Hi all,
    forgive me if this is the wrong folder.
    I am googling scripts to find a PS script to count file types and files in several directory's on our network.
    I am a noob on powershell, and I'm trying to experiment.
    I have several directory's on my "Libraries" directory on my pc at work. I'm just trying to test a PS script to get this to work to count the files and list the file types in my "Libraries\Documents\Tidbits" folder.

    Code:
    Get-ChildItem \\hilltop3\users$\LongRandy\My Documents\TIDBITS
    but I get this error:"Get-ChildItem : Cannot find path '\\hilltop3\users$\LongRandy\My' because it does not exist.
    At line:1 char:14
    + Get-ChildItem <<<< \\hilltop3\users$\LongRandy\My Documents\TIDBITS
    + CategoryInfo : ObjectNotFound: (\\hilltop3\users$\LongRandy\My:String) [Get-ChildItem], ItemNotFoundExc
    eption
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand"

    How can I put in the ENTIRE file path? It just arbitrarily truncates the path?

    Thanks again
      My Computer


  2. Posts : 1,810
    Dual Boot: Windows 8.1 & Server 2012r2 VMs: Kali Linux, Backbox, Matriux, Windows 8.1
       #2

    You may find someone qualified for answering this here but your best bet is a place like this https://social.technet.microsoft.com...rverpowershell
      My Computer


  3. Posts : 1,049
    Windows 7 Pro 32
       #3

    As a general rule when supplying parameters to any program: add quote signs around it if it contains space characters

    "\\hilltop3\users$\LongRandy\My Documents\TIDBITS"

    A space character is the universal separator for parameters, so in your case, without quotes, the program thinks you're supplying 2 parameters:
    1. \\hilltop3\users$\LongRandy\My
    2. Documents\TIDBITS
      My Computer


 

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

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