Directory Listing Help

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?

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

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.

There is actually never a ‘too much information’ :wink: 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?

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?

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. ;-)

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

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.

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.

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

Define what you’re saying with the term “code”? I don’t know what that is.

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

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.

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?

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.

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.

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. :wink:

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

:wink: 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.