On Dec 30, 10:29 am, sardinian_guy <gu...[ at ]unknown-email.com> wrote:
[Quoted Text] > Hallo guys and happy new year to everybody. :D > Sometimes to make tests I need to assign different creation dates > between a specific range to my files. I'm looking for a way to do it > with powershell. > > I found this article > 'Generate Random Dates in PowerShell « saadware' > ( http://blog.saadware.com/2008/06/12/generate-random-dates-in-powershell/)> > but i don't know how to apply this code to each file within a folder. > Thanks in advance. > > -- > sardinian_guy Hi,
If you install the PowerShell Community Extensions from http://www.codeplex.com/powershellcx - there is a Cmdlet called Set- FileTime which will let you do this:
ps> dir c:\files\ -rec -inc *.txt | set-filetime -created (get- randomdate)
(get-randomdate is your function)
- Oisin
|