I know this command C:\>dir /TC- > text.txt at window but it only list the file in date and time but there is no second. hh:mm Using this application code.google.com/p/stexbar/ I can clearly see there was a second timestamps hh:mm:ss Any reason why dir cannot view the second ?
Because the command does not offer such functionality. But you can use Powershell (integrated in Vista and above) to view the full creationtime hh:mm:ss get-item * | ft Name,CreationTime | Out-File text.txt
Thank you , what if I wanted to list it inside a folder including the files with creationtime in second ? and also human readable format size ? I try and search "Get-ChildItem" but it come out with just hh:mm without the ss. When comes to Dir I know about CD to the folder and listing out the folder with files Code: dir /S /OGN /TC /A- > C:/test.txt I just wanted to list out with creationtime with :SS How do I convert the dir above to powershell ?
get-item is not quite correct (my mistake ). Better you use 'get-childitem': Code: Get-ChildItem -Recurse | ft creationtime,mode,length,name >c:\test.txt if you want to know how to use get-childitem: Code: Get-ChildItem | Get-Member get-help get-childitem -online Hope this helps...
Thank you very much How do I sort the ordering ? Such as Alphabetical order or File creation ? Would like to know , how to output the length in MB or human readable format ? Now reading the ChildItem help file Thanks again
To sort an object by a property use 'sort-object' (isn't that easy ) Code: get-childitem | sort-object length -descending get-childitem | sort-object creationtime To convert from bytes to MB or kb or GB or whatever use this pattern: @{n='Field';e={[int]($_.Property/1kb)}} with select-object. Field is just a Text. Property is from Get-Member (eg. get-childitem | get-member) Change KB to MB, GB, TB, PB Code: get-childitem | sort-object length -descending | select-object name,@{n='Size in kb';e={[int]($_.Length/1kb)}} gives the following output: Name Size in kb ---- ---------- PsExec.exe 373 Schema.csv 194 EnumOpenFiles4.ps1 5 Terminal.RDP 2
I found some code and modified it some of it Code: I can't get the file name and date creation,lastwritetime to display fully. Anyway to fix the code ? what did I miss ? -Updates Going further adding wrap and autosize, I am getting errors from the table code 1) WARNING: column "GB" does not fit into the display and was removed. 2) The path didn't get output Again , possible to fix the column to fit all inluding the path ?
You get the path with "fullname" instead of "Name". format-table is tied to the output screen, so you have to resize the Screen (Alt + Space -> Properties). And remove either warp or autosize. both doesn't work. An other option is to use export-csv instead of out-text. This gives you a comma seperated value text file. Other possibilities are convertto-html or convertto-XML. Or just kick out a column. It makes no sense to have everything in one table. Good luck...
Ok , thanks for the suggestion. There's also an error I encouter , if there's more than 8 sub directory folder with a blank spacing on most of the folder. How do I output it ? Get-ChildItem : Cannot find path L:\test doc'' because it does not exist. sorry again for bothering