tags:

views:

23

answers:

1

I would like help with a PowerShell script that does exactly what this one (I found on this site) does, except I have tried to add another column for the file size and I can't seem to figure that part out. I need one that does specific file extensions, but also if anyone knows how to get a FULL listing of every file and folder with their sizes in the same format as this one, that would be great. Thanks!

ls -r -fi *.doc | sort @{expression={$_.Name}}, 
                       @{expression={$_.LastWriteTime};Descending=$true} | 
                  select Directory, Name, lastwritetime 
ls -r -fi *.xls | sort @{expression={$_.Name}}, 
                       @{expression={$_.LastWriteTime};Descending=$true} | 
                  select Directory, Name, lastwritetime 
+1  A: 

The file size is specified by the Length property e.g.:

ls . -r *.xls | sort @{expression={$_.Name}},
                     @{expression={$_.LastWriteTime};Descending=$true} | 
                select Directory, Name, LastWriteTime, Length
Keith Hill