I have a hard drive full of backups that I need to detail on a spreadsheet quickly and in the following specific way. I'm hoping there's an easy way to do what i need via some sort of .bat or .cmd file but i don't know where to start.
All i need is the first two folder levels in the hierarchy to go to csv:
And this is the data i need to export from the drive:
I have attempted to use the following code in powershell:
cd\ c: <--- where my test folder resides
cd\ test <--- contains my test folder structures to output
then this which i found before posting my question.
Get-ChildItem -Recurse -Directory -Depth 3 | Select-Object FullName | Export-Csv Test.csv -NoTypeInformation
And i realise that i somehow need to use
Select-Object to specify more folder properties to output to the csv but i can't seem to get the above to work in the basic way it should.
Instead i get the following error thrown back at me:
Get-ChildItem : A parameter cannot be found that matches parameter name 'Directory'. At line:1 char:34 + Get-ChildItem -Recurse -Directory <<<< -Depth 3 | + CategoryInfo : InvalidArgument: (:) [Get-ChildItem], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
I have also tried importing my test folder into Notepad++ and i'm able to see it as a Workspace i can browse but unable to export to csv with the information i need. The only options i can see there is what you see in the screenshot when i right click the directories and no option to output (I'm no expert in this).
The other thing i tried was creating a test.cmd file with the following inside it:
C:\TEST\ dir >> C:\TEST\test.csv
After running this, it appears to be bringing me a tad closer to what i'm looking for but i'm still not seeing the information i need as specified in my original excel screenshot at the top of this post:
As you can see i'm lacking the proper directory path and all i see is
<DIR> instead, i also can't see the second level in the folder structure containing the sub-folders. The file count and size for each folder and the sorting into columns is also not correct.
Can anyone with the knowledge of command based database creation help me? My question was put on hold because it wasn't detailed enough but i've now put in the maximum effort to explain everything i've tried and with over 2 petabytes of storage backups to spreadsheet from our Nearline storage I need to be able to do this quickly and efficiently.
Many thanks in advance.