How can I export entire HDD filenames to csv/Excel


lbeck

Active member
Member
Local time
11:55 PM
Posts
39
OS
Windows 11
I have 10-15 TB of data on several HDD/SSDs. Because of some terrible misfortune I’ve lost many important files (mostly pictures). I do have some redundancy. Since this may be the result of malware, I’ve disconnected my main computer from the Internet.

I now want to view a list of my thousands of filenames to a spreadsheet or workbook. I’m fairly proficient with spreadsheets. I can data/sort to find what is really important and save to Excel after culling out duplicates with Duplicate Cleaner Pro. Finally save these important files to a separate external drive and protect it.

How do I export filenames from each of my several drives to spreadsheet or workbook?
 

My Computers

System One System Two

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    Device name CyberPowerPC
    CPU
    13th Gen Intel(R) Core(TM) i5-13400F 2.50 GHz
    Memory
    32.0 GB
    Graphics Card(s)
    NVIDIA Gforce RTX 4060
    Hard Drives
    2 TB ADATA Legend 800 Gold SSD and several HDDs
    PSU
    650W
    Browser
    Chrome
    Other Info
    Windows 11 23H2 Build 22631.3737
  • Operating System
    Windows 10 Home 22H2 19045.4123
    Computer type
    PC/Desktop
    Manufacturer/Model
    Acer_Desktop
    CPU
    Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz 3.60 GHz
    Memory
    32.0 GB
    Graphics card(s)
    Gforce GTX 745
    Sound Card
    ONN24
    Hard Drives
    Many
    Mouse
    Acer wired USB
    Keyboard
    JLAB supports 2 computers/monitors
    Browser
    Chrome
    Antivirus
    Only what W10 installed
    Other Info
    64-bit operating system, x64-based processor
Didn't really test, but there is nothing destructive about it. From Powershell copy/paste and run
Powershell:
$ExportFile = "$($env:username)\Desktop\AllFiles.csv"

$Volumes = Get-Volume | ? { -not [string]::IsNullOrEmpty($_.DriveLetter) -and $_.FileSystemType -notlike "Unknown"}

foreach ($Volume in $Volumes) {
    $DriveLetter = "$($Volume):\"
    $Files = Get-ChildItem -Path $DriveLetter -Recurse -File -ErrorAction SilentlyContinue

    $Files | Select-Object -Property Name,FullName | Export-Csv -Path $ExportFile -Append
}
 

My Computer

System One

  • OS
    Windows 11
Back
Top Bottom