Categories
Technology - Tips

Script to Fetch all Directory and Files Details from a Folder or Drive

Script to Fetch all Directory and Files Details from a Folder or Drive

Hi friends in this post we will learn how to Script to Fetch all Directory and Files Details from a Folder or Drive, Fetch all files information from a Folder or Drive.

This comes to my mind yesterday when I am working on my system and looked that one of my drive is out of space, it have lots of files and folders. So next thing is to found out space consumed by these files(manually or by some script that export all file/folder details to a CSV file). So I prepared a Powershell script that saved my time and of-course lots of manual work.

Earlier we had discussed  How To Connect FTP Through Command PromptHow to check your windows system last BOOT timeHow to get all running process list through command lineHow To Get List Of Same File Type Through Command PromptHow To Save PING Status To a TXT FileUpload Files To An FTP Via a Batch Script.

Script:

get-childitem c:\ | 
select Name, CreationTime, Directory, Author, LastAccessTime, Extension, @{N="File Size";E={$_.Length / 1MB}} |
Export-Csv "c:\ListFiles.csv" -nti

Result:

Script to Fetch all Directory and Files Details from a Folder or Drive

Note: It will not display size of folders.