jamesholyoak
Programmer
I am having a problem with this script. I want to go into a folder, check if any of the documents are more than a week old and if they are, copy them to a another folder.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"
Set FileList = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='c:\test'}
For Each objfile In FileList
window.onload=fnInit;
function fnInit(){
var oCreated=new Date(document.fileCreatedDate);
var oToday=new Date();
var iMilliSeconds=86400000;
var iDaysBetween=(oToday.getTime() - oCreated.getTime()) / iMilliSeconds;
alert("Created: " + oCreated + "\nDays since created: " +
parseInt(iDaysBetween));}
If iDaysBetween > 6 Then
objfile.Copy "E:\group_1\app1"
Next
End
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2"
Set FileList = objWMIService.ExecQuery _
("ASSOCIATORS OF {Win32_Directory.Name='c:\test'}
For Each objfile In FileList
window.onload=fnInit;
function fnInit(){
var oCreated=new Date(document.fileCreatedDate);
var oToday=new Date();
var iMilliSeconds=86400000;
var iDaysBetween=(oToday.getTime() - oCreated.getTime()) / iMilliSeconds;
alert("Created: " + oCreated + "\nDays since created: " +
parseInt(iDaysBetween));}
If iDaysBetween > 6 Then
objfile.Copy "E:\group_1\app1"
Next
End