On May 16, 10:53 am, Jeffery Hicks <"jhicks[at]SAPIEN.com"> wrote:
> On 16 May 2007 07:09:51 -0700, brhessel wrote:
>
> > I'm trying to learn Powershell (reading Powershell in Action right
> > now) but I am struggling with some of the basics and running out of
> > time for a script I need.
>
> > I want to find all files with a certain extension on a share and
> > output the results in a nice format that contains the path, name, size
> > in MB, and last access time. So far I have:
>
> > get-ChildItem -recurse -include a_*.nsf | Out-File -FilePath c:
> > \archives.txt
>
> > but this doesn't give me all the information I am looking for nor put
> > it in a very nice format. I'm sure if I spend some more time on this I
> > could get it but right now I am in a rush. Thanks for any help.
>
> You are on the right track. Try something like this:
> PS S:\ > gci *.bat | select FullName,Length,LastAccessTime | out-file
> .\batfiles.txt
>
> One thing about LastAccessTime is that it is not necessarily the last time
> a user accessed the file. Things like Antivirus scans and defrags can
> affect this property.
>
> --
> Jeffery Hicks
> SAPIEN Technologies - Scripting, Simplified.www.SAPIEN.com
> VBScript & Windows PowerShell Training -www.ScriptingTraining.com/classes.asp
> Windows PowerShell? -www.SAPIENPress.com/powershell.asp
>
> blog:http://blog.SAPIEN.com
> blog:http://jdhitsolutions.blogspot.com
Ok so I am up to:
get-ChildItem -recurse -include a_*.nsf |Select-Object
Name,FullName,Length,LastAccessTime |export-Csv -path C:\archives.csv
How do I convert the Length into MB before exporting it?