Afficher un message
Vieux 03/10/2007, 17h39   #1
tonyr
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: Script to echo files based on specific dates

also if your new to scripting I'd make the switch to powershell, you
shouldn't have all the mental barriers us vbs guys have!
my .00000000001 cents worth

the equivelant I think would be

ls d:\somedir -rec | foreach {$_.creationtime -lt "01/02/2007"}

if its a remote device then

ls \\servername\d$\somedir -rec | foreach {$_.creationtime -lt "01/02/2007"}



"Walid" wrote:

> Hi,
> I am pretty new to scripting. I found this script from "scripting guy" and
> I want to know how I can echo or even delete files within a specific folder
> (for example D:\folder1\subfolder2\test) for files older than Jan 2nd 2007.
> I thought it would work if I change the line " AND Drive =
> 'D:\folder1\subfolder2\test'"). But this doesn't work. I would appreciate
> any !
>
> Thanks,
>
> WG
>
> strDate = "20070102000000.000000+000"
>
> strComputer = "."
> Set objWMIService = GetObject _
> ("winmgmts:\\" & strComputer & "\root\cimv2")
> Set colFiles = objWMIService.ExecQuery _
> ("Select * From CIM_DataFile Where CreationDate < '" & strDate & "'" & _
> " AND Drive = 'D:'")
> For Each objFile in colFiles
> Wscript.Echo objFile.Name
> Next
>
>

  Réponse avec citation
 
Page generated in 0,04537 seconds with 9 queries