List out files in directory and it's each sub-directory using Power Shell
Ravi Sekhara Reddy . G
Team Lead at Tech Mahindra| SQL Server DBA | PostgreSQL DBA | Power BI | Cloud Consultant | Expert in SQL Server Administration & Azure Cloud Solutions ??
Get list of file names in directory and it’s each sub directory using PowerShell
Step:- Open PowerShell as Administrator mode and execute the below script
Get-ChildItem 'D:\Learn_Something' -recurse | where-object { $_.FullName -ne $NULL -and $_.DirectoryName -ne $NULL} |
select-object DirectoryName,Name,FullName
Export Results to CSV : -
If you want to export directory, file name along with path information into csv use below
Note: Change the Location and CSV export location
Get-ChildItem 'D:\Learn_Something' -recurse | where-object { $_.FullName -ne $NULL -and $_.DirectoryName -ne $NULL} |select-object DirectoryName,Name,FullName |
Export-CSV D:\Files_Info.csv