Exporting view of Windows Explorer into a csv/txt?

Syringer

Lifer
Aug 2, 2001
19,333
3
71
Basically I want a view of all my files/folders/dates in a spreadsheet format so I can easily see what's last been modified and when.

I know in DOS you can do dir > blah.txt but that doesn't give me the detailed view that Explorer gives. Is there a program that can do that?
 

postmark

Senior member
May 17, 2011
307
0
0
you could do something like dir /o:d /t:w > out.txt

that would give you files sorted by date by oldest first, and this shoudl use the last written date. you could throw the /s in there as well to get subdirectories too.
 

Syringer

Lifer
Aug 2, 2001
19,333
3
71
That actually works pretty well, but there's lots of subdirectories here that I want to be able to see..basically itd look like this:

6/1 1pm c:\a\a.txt
6/1 1pm c:\a\b.txt
6/1 1pm c:\a\c.txt
6/1 1pm c:\b\a.txt

Using the above method is just:

6/1 1pm b.txt
6/1 1pm c.txt

Without full directory information which I need.
 

postmark

Senior member
May 17, 2011
307
0
0
yeah, unfortunately you can't get both with the built in dir command in windows. You can use the /b switch to get full path, but then you lose all the date info. You could write a quick perl script to append the path listed at the Directory of <path> to each file name if you really needed it.
 

yinan

Golden Member
Jan 12, 2007
1,801
2
71
# This script will export all of the information from a directory and all of its subdirectories into a csv file

$workingDir = "c:\Windows\system32"
$outputFile = "c:\temp\list.csv"

function main
{
# Check and make sure the directory exists
if ( Test-Path $workingDir )
{
$filesList = Get-ChildItem -Path $workingDir -Recurse -force | where { ! $_.PSIsContainer }

$headerLine = "Date,FileName"
$content = @()
$content = $content + $headerLine
foreach($file in $filesList)
{
$line = (($file.LastWriteTime).ToString()) + "," + ($file.FullName)
$content = $content + $line
}

$contentResult = Set-Content -Path $outputFile -Value $content -Force
}
else
{
Write-Output "$workingDir path not found."
}


}

main