0

I need hierarchical listing of all files along with Extended File Details.

My question is similar to How can I export a directory structure? Both answers mentioning tree and Get-ChildItem commands are good for me, but I just want to add to each item the Extended File Details.

Extended File Details I want are:

  • Full Path (e.g. I:\MS\Ly\Video\122453.mp4)
  • File Type (in the format EXT - DESCRIPTION, e.g. MP4 - MPEG-4 video files)
  • Size (e.g. 21.78 MB) (Also, I need to be able to show this in bytes)
  • Created (File creation date, e.g. 21-Nov-17 1:45:15 AM)
  • Modified (File modification date, e.g. 21-Nov-17 1:45:17 AM)
  • Accessed (Last file Access date, e.g. 23-Nov-17 2:30:03 PM)

Example of Extended File Details that I can get from the context menu in Bulk Rename Utility:

Filename    Parent Folder   Full Path   File Type   Size    Created Modified    Accessed
122453.mp4  Video   I:\MS\Ly\Video\122453.mp4   MP4 - MPEG-4 video files    21.78 MB    21-Nov-17 1:45:15 AM    21-Nov-17 1:45:17 AM    23-Nov-17 2:30:03 PM

Example of the output I want:

I:
├───Folder A          ■[▪«Parent Folder: I:\», ▪«Full Path: I:\Folder A», ▪«File Type:  File folder», «Size: 65.34 MB (65,343,693 B) — Contains: 3 Files, 0 Folders», ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   ├───File A1.mp4          ■[▪«Parent Folder: Folder A», ▪«Full Path: I:\Folder A\File A1.mp4», ▪«File Type: MP4 - MPEG-4 video files», «Size: 21.78 MB (21,781,231 B) », ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   ├───File A2.mp4          ■[▪«Parent Folder: Folder A», ▪«Full Path: I:\Folder A\File A2.mp4», ▪«File Type: MP4 - MPEG-4 video files», «Size: 21.78 MB (21,781,231 B) », ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   └───File A3.mp4          ■[▪«Parent Folder: Folder A», ▪«Full Path: I:\Folder A\File A3.mp4», ▪«File Type: MP4 - MPEG-4 video files», «Size: 21.78 MB (21,781,231 B) », ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
├───Folder B          ■[▪«Parent Folder: I:\», ▪«Full Path: I:\Folder B», ▪«File Type:  File folder», «Size: 21.78 MB (21,781,231 B) — Contains: 1 Files, 0 Folders», ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   └───File B1.mp4          ■[▪«Parent Folder: Folder B», ▪«Full Path: I:\Folder B\File B1.mp4», ▪«File Type: MP4 - MPEG-4 video files», «Size: 21.78 MB (21,781,231 B)», ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
├───Folder C          ■[▪«Parent Folder: I:\», ▪«Full Path: I:\Folder C», ▪«File Type:  File folder», «Size: 21.78 MB (21,781,231 B) — Contains: 1 Files, 1 Folders», ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   └───Folder C1          ■[▪«Parent Folder: Folder C», ▪«Full Path: I:\Folder C\Folder C1», ▪«File Type:  File folder», «Size: 21.78 MB (21,781,231 B) — Contains: 1 Files, 0 Folders», ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│       └───File C1a.mp4          ■[▪«Parent Folder: Folder C1», ▪«Full Path: I:\Folder C\Folder C1\File C1a.mp4», ▪«File Type: MP4 - MPEG-4 video files», «Size: 21.78 MB (21,781,231 B) », ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
├───Folder D          ■[▪«Parent Folder: I:\», ▪«Full Path: I:\Folder D», ▪«File Type:  File folder», «Size: 87.12 MB (87,124,924 B) — Contains: 4 Files, 6 Folders», ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   ├───Folder D1          ■[▪«Parent Folder: Folder D», ▪«Full Path: I:\Folder D\Folder D1», ▪«File Type:  File folder», «Size: 21.78 MB (21,781,231 B) — Contains: 1 Files, 2 Folders», ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   │   └───Folder D1a          ■[▪«Parent Folder: Folder D1», ▪«Full Path: I:\Folder D\Folder D1\Folder D1a», ▪«File Type:  File folder», «Size: 21.78 MB (21,781,231 B) — Contains: 1 Files, 1 Folders», ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   │       └───Folder D1a1          ■[▪«Parent Folder: Folder D1a», ▪«Full Path: I:\Folder D\Folder D1\Folder D1a\Folder D1a1», ▪«File Type:  File folder», «Size: 21.78 MB (21,781,231 B) — Contains: 1 Files, 0 Folders», ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   │           └───File D1a1a.mp4          ■[▪«Parent Folder: Folder D1a1», ▪«Full Path: I:\Folder D\Folder D1\Folder D1a\Folder D1a1\File D1a1a.mp4», ▪«File Type: MP4 - MPEG-4 video files», «Size: 21.78 MB (21,781,231 B) », ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   ├───Folder D2          ■[▪«Parent Folder: Folder D», ▪«Full Path: I:\Folder D\Folder D2», ▪«File Type:  File folder», «Size: 21.78 MB (21,781,231 B) — Contains: 1 Files, 0 Folders», ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   │   └───File D2a.mp4          ■[▪«Parent Folder: Folder D2», ▪«Full Path: I:\Folder D\Folder D2\File D2a.mp4», ▪«File Type: MP4 - MPEG-4 video files», «Size: 21.78 MB (21,781,231 B) », ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   ├───Folder D3          ■[▪«Parent Folder: Folder D», ▪«Full Path: I:\Folder D\Folder D3», ▪«File Type:  File folder», «Size: 43.56 MB (43,562,462 B) — Contains: 2 Files, 0 Folders», ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   │   ├───File D3a.mp4          ■[▪«Parent Folder: Folder D3», ▪«Full Path: I:\Folder D\Folder D3\File D3a.mp4», ▪«File Type: MP4 - MPEG-4 video files», «Size: 21.78 MB (21,781,231 B) », ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   │   └───File D3b.mp4          ■[▪«Parent Folder: Folder D3», ▪«Full Path: I:\Folder D\Folder D3\File D3b.mp4», ▪«File Type: MP4 - MPEG-4 video files», «Size: 21.78 MB (21,781,231 B) », ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]
│   ├───Folder D4          ■[▪«Parent Folder: Folder D», ▪«Full Path: I:\Folder D\Folder D4», ▪«File Type:  File folder», «Size: 0 — Contains: 0 Files, 0 Folders», ▪«Created: 21-Nov-17 1:45:15 AM», ▪«Modified: 21-Nov-17 1:45:17 AM», ▪«Accessed: 23-Nov-17 2:30:03 PM»]

I'm planning to develop such a solution (if none exist) using AutoHotkey. So I'm going to post separate programming-specific questions on StackOverflow related to this question. I will put links to them here as soon as I post them (just in case someone with programming experience want to share some answer which will boost the answering of this super-user question).

0

Get-ChildItem will work but it won't show you the hierarchical levels like tree will. An issue with using tree for this is it isn't passing objects, adding difficulty to getting each item's properties. We'd need to pipe tree to ForEach-Object, parse each result from the right until you hit a leaf (not getting confused with potential special characters in each file or directory name), then query for properties.

You can do it, and there are many approaches to this, but you may want to look for existing solutions first.

Check out Show-Tree (lines 1633-1866) from the PowerShell Community Extension project (PSCX). The output of Show-Tree -ShowLeaf -ShowProperty is very close to your criteria, albeit the extended properties are not joined to the source object.

C:\users\username\Desktop
├──Property: Attributes = ReadOnly, Directory
├──Property: BaseName = Desktop
├──Property: CreationTime = 12/03/2017 16:43:05
├──Property: CreationTimeUtc = 12/03/2017 21:43:05
├──Property: Exists = True
├──Property: Extension =
├──Property: FullName = C:\users\username\Desktop
├──Property: LastAccessTime = 12/17/2017 10:07:29
├──Property: LastAccessTimeUtc = 12/17/2017 15:07:29
├──Property: LastWriteTime = 12/17/2017 10:07:29
├──Property: LastWriteTimeUtc = 12/17/2017 15:07:29
├──Property: LinkType =
├──Property: Mode = d-r---
├──Property: Parent = username
├──Property: Root = C:\
├──Property: Target =
├──test.ps1
│  ├──Property: Attributes = Archive
│  ├──Property: BaseName = test
│  ├──Property: CreationTime = 12/16/2017 08:24:22
│  ├──Property: CreationTimeUtc = 12/16/2017 13:24:22
│  ├──Property: Directory = C:\users\username\Desktop
│  ├──Property: DirectoryName = C:\users\username\Desktop
│  ├──Property: Exists = True
│  ├──Property: Extension = .ps1
│  ├──Property: FullName = C:\users\username\Desktop\test.ps1
│  ├──Property: IsReadOnly = False
│  ├──Property: LastAccessTime = 12/16/2017 10:46:37
│  ├──Property: LastAccessTimeUtc = 12/16/2017 15:46:37
│  ├──Property: LastWriteTime = 12/16/2017 10:46:37
│  ├──Property: LastWriteTimeUtc = 12/16/2017 15:46:37
│  ├──Property: Length = 3285
│  ├──Property: LinkType =
│  ├──Property: Mode = -a----
│  ├──Property: Target =
│  └──Property: VersionInfo = File:             C:\users\username\Desktop\test.ps1
└──Artist - Title (Full Album).mp3
   ├──Property: Attributes = Archive
   ├──Property: BaseName = Artist - Title (Full Album)
   ├──Property: CreationTime = 12/15/2017 20:24:41
   ├──Property: CreationTimeUtc = 12/16/2017 01:24:41
   ├──Property: Directory = C:\users\username\Desktop
   ├──Property: DirectoryName = C:\users\username\Desktop
   ├──Property: Exists = True
   ├──Property: Extension = .mp3
   ├──Property: FullName = C:\users\username\Desktop\Artist - Title (Full Album).mp3
   ├──Property: IsReadOnly = False
   ├──Property: LastAccessTime = 12/15/2017 20:24:41
   ├──Property: LastAccessTimeUtc = 12/16/2017 01:24:41
   ├──Property: LastWriteTime = 12/15/2017 20:25:34
   ├──Property: LastWriteTimeUtc = 12/16/2017 01:25:34
   ├──Property: Length = 45120000
   ├──Property: LinkType =
   ├──Property: Mode = -a----
   ├──Property: Target =
   └──Property: VersionInfo = File:             C:\users\username\Desktop\Artist - Title (Full Album).mp3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.