Directory Listing Help

This topic contains 22 replies, has 4 voices, and was last updated by  Clint Kuykendall 3 weeks, 6 days ago.

  • Author
    Posts
  • #102964

    Clint Kuykendall
    Participant

    I am trying to run a Get-ChildItem and Get-Item * list in powershell to generate a listing of all files in a single folder. Problem I'm having is that when I run either of those commands in powershell, I'm only getting half of the folder in the list format. The list should be over 4K lines long, but is barely reaching 3K lines. How can I get the entire folder listed out or is there something that is preventing the full list from being generated?

  • #102965

    Olaf Soyk
    Participant

    We won't be able to help you without seeing your code.

  • #102968

    Clint Kuykendall
    Participant

    I need to know exactly what you need to see so that I can provide it. I don't work with code and am trying to run this listing as the original person that figured it out was using the Command Window from an older version of Windows and my laptop uses PowerShell.

  • #102971

    Olaf Soyk
    Participant

    There is actually never a 'too much information' 😉 The more you provide the easier could it be to help you. What do you run in what environment and how is it not working as expected?

    • #102973

      Clint Kuykendall
      Participant

      I'm running Windows 10, basic office environment, not working for a computer company or anything. I'm trying to run and to see a listing of all files in a single folder that is part of a shared drive with the company. The folder has 4257 files in it, and the Get ChildItem and Get Item codes are only pulling out 2997 of the 4257 files. Once everything has been removed from duplicates and files that aren't what are being checked for, the list should be 1000 files less. Using the Command Window to run a dirlist on older versions of Windows got all of the files in the folder, so I'm looking for something that is the newer version of the dirlist command to run through PowerShell. Does that help?

  • #102976

    Olaf Soyk
    Participant

    Does that help?

    hhmmm ... not that much. Is it possible to see what commands you run? What happens when you run this commands? I cannot see your console window. 😉

  • #102977

    Alan Williams
    Participant

    I just ran the following on my C:\Windows\System32 directory and it seemed to work:

    Get-ChildItem C:\Windows\System32\ -File  | measure
    
    Count    : 4331
    Average  :
    Sum      :
    Maximum  :
    Minimum  :
    Property :
    

    Even with the -recurse switch, it returned 20K files... I did get some "Access Denied" errors...

    Seeing your code would be very helpful... >:P

    • #102980

      Olaf Soyk
      Participant

      Funny. I tried something similar:

      Get-ChildItem -Path C:\Windows -Recurse -Force -File -OutVariable AllWinFiles
      $AllWinFiles.Count
      136219

      So it is not the sheer number of files to count what causes the problem.

  • #103061

    Clint Kuykendall
    Participant

    When I open Power Shell, I'm holding shift and right clicking on the folder to run it. When the Power Shell window opens up it displays: PS T:\Dept\Import\Import Entry Record\Essilor Import Docs 2018>
    From the end of the line above, I'm then telling it to do which then pulls up the list I'm wanting, but only half of it.

    • #103082

      Olaf Soyk
      Participant
    • #103087

      Clint Kuykendall
      Participant

      I don't know CODES!!!
      I was given this site from the IT people at my company to use as they were tied up on other projects and unable to help me figure out the Power Shell commands. I work in International Trade Compliance, so coding/codes are nothing I have any knowledge of.

  • #103064

    Joel Sallow
    Participant

    What code are you running to get this list, exactly?

    • #103066

      Clint Kuykendall
      Participant

      Define what you're saying with the term "code"? I don't know what that is.

    • #103076

      Joel Sallow
      Participant

      What commands are you entering, with what parameters, to get this truncated list?

    • #103079

      Clint Kuykendall
      Participant

      I'm entering:
      Get-ChildItem>
      That's it.
      I'm trying to get all files in that single folder to show up so that I can verify it with a list of file numbers that are pulled from the US Customs Environment for all of the entries processed under our specified importer ID's.

    • #103084

      Olaf Soyk
      Participant

      And how do you know it's not the complete list? Where do you know it's only 2997 instead of 4257? Did you count them by hand?
      What kind of files are there? Do you have any hidden or system files? Do you have read access to all this files with the account you run this cmdlet?

    • #103088

      Clint Kuykendall
      Participant

      I copied the list to excel where it showed me how many lines it was and compared that to the log we have of all entry numbers and the other list that someone else had run using Command Window on an older laptop. I can't run anything with the Command Window as that person is on vacation and I'm trying to run the same report on my laptop while they're out. The files that are in the folder are pdf, doc, tif, xlsx, & txt. I'm only needing the files that are pdf, doc, tif and have to sort the rest out to make sure I have the correct number of files that match the excel list we use for auditing. Sorry, the email didn't show me your full reply.

    • #103091

      Olaf Soyk
      Participant

      You might take a little step back and start with learning the very basics of Powershell from scratch. In this thread you'll find some great sources to start from: Beginner Sites and Tutorials. Espacially the free video courses from the Microsoft Virtual Academy are really good and even slightly entertaining.

      Try running the following code:

      Get-ChildItem -Recurse -Force -OutVariable allFiles | Out-Null
      $allFiles.count

      That's what we call code. 😉

    • #103094

      Clint Kuykendall
      Participant

      Would I run the code you listed before or after that long line that shows up starting with PS?

  • #103097

    Olaf Soyk
    Participant

    😉 you really should start with learning the basics first. This will save you from a lot of wasted time and frustration.
    If you're able to run it before "that long line that shows up starting with PS" run it before. Otherwise run it after.
    BTW: that's the path of the folder. You should check if it's the desired one.

    • #103099

      Clint Kuykendall
      Participant

      I will look at the basics link over the weekend and try to run it on Monday. The line with the PS is the desired folder. Does it make it more difficult that it's a shared folder even as I have full read access to the folder?

    • #103102

      Olaf Soyk
      Participant

      Does it make it more difficult that it's a shared folder even as I have full read access to the folder?

      No. You just have to be sure about your rights on all of the files. That's all.
      Here you have a direct link: MVA Getting Started with Powershell
      Have fun!

    • #103103

      Clint Kuykendall
      Participant

      Thank you for the help and have a good weekend!
      I'll post on Monday if I have any other questions.

You must be logged in to reply to this topic.