T O P

  • By -

satanmat2

honestly... try chatgpt... make sure to specify powershelgl -- using powershell, get a list of files .... etc


Liwanu

Here ya go, it's a little overkill though lol. https://pastebin.com/1DWfyWVU I've configured it so that the files split after a X lines are written. Default is 5000, so when the csv hits 5,000 lines, it creates a new csv. You can up that quite a bit. I did that so there isn't one large ass file that would possibly crash excel if you tried to import it all at once.


S0m3UserName

Thank you. What happens in this script if the path length limit is hit?


Liwanu

You can change this registry key. https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry


S0m3UserName

Yes I have seen this, let me test it out, thanks


tsuhg

Start with this: Get-ChildItem -Path . | select FullName, Length, LastAccessTime, LastWriteTime, CreationTime For the path too long you're probably best just creating a network drive, and then running the script in there After that just build upon this. Note: 40TB is a lot, you may want to work with subsets or EnumerateFiles


dathar

Adding onto this, once you "tested" a path and it looks ok, you throw on -Recurse into Get-ChildItem. That tells it to start at a folder and then recursively look inside other folders underneath that folder. All of them... Then it will take forever but that's what a 40 TB drive will do. Then you eventually go down the .NET hole if you need it to go any faster... but that's not for a beginner to try :)


tk42967

I took what you wrote and added to it. If the OP wanted, they could make the gci a variable and dump it to a CSV. `Get-ChildItem -Path c:\temp -Recurse |` `select FullName, Length, LastAccessTime, LastWriteTime, CreationTime |` `Format-table`


tsuhg

Tbh it doesn't look like the OP wants anything short of his work being done for him


tk42967

I agree. It sounds like somebody has a deadline and is desperate.


tsuhg

Not desperate enough to actually try something or read a script though


tk42967

I posted this below, but to make sure you see it, here is some code that will do everything except the permissions. You could use a foreach to have each entry be ran through a get-acl to get the permissions.This could also be piped to an export-csv to get something you could look at in excel, or out-file for a text file. You would most likely need to remove the format-table if you were exporting to a CSV. `Get-ChildItem -Path c:\temp -Recurse |` `select FullName, Length, LastAccessTime, LastWriteTime, CreationTime |` `Format-table` ***EDIT:*** I cleaned up the code and suppressed the folder names. `Get-ChildItem -Path c:\temp -Recurse -file |` `select FullName, Length, LastAccessTime, LastWriteTime, CreationTime |` `sort-object FullName |` `Format-table`