Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

count files in two folders using time frame

Status
Not open for further replies.

Ehvbs

Programmer
Mar 13, 2009
2
US
Here wat am trying to acheive.

1) I have a file come thru webportal.and copy the file in Production Server named as "PX_ZZWC1801_2_03112009_115128_439_HS00140.TXT_1.TXT
"
2)The same file copied to Development server in the name of "PX_ZZWC1801_1_03112009_115127_140_PX_ZZWC1801_2_03112009_115128_439_HS00140.TXT_1.TXT"

3) see the file name in the development server

First part :"PX_ZZWC1801_1_03112009_115127_140
Second Part:_PX_ZZWC1801_2_03112009_115128_439_HS00140.TXT_1

Second part is the concatenation of the Production server file name,so in that way i can make file name unique and easy to find it out the files in my development server.

now this the 24/7 process the file will come and copy to production and development server in every min or so.

Now what am trying to do is

1)check the file in production server and grab the file name go to development server and find the file is exist or not.
2)if its exist no action if its not then send mail about the missing file.
3)I script should run every three hours to find the syn or non sync between production and development server files.

For example:


assume i have file in production server "PX_ZZWC1801_2_03112009_115128_439_HS00140.TXT_1.TXT
" copied at 9.00 AM.

The same file copied to development server at 9.01 AM.

when the script runs at 12 Pm ,it will suppose to check all the files from 9Am to 12 Pm in production server and match up with development server.

So far i achieve

'==========================================================================
Option Explicit
'On Error Resume Next
Dim objFso, sfolder, dfolder, colfolder, colfolder2, objitem1, objitem2
Dim tempStore, item
sfolder = "C:\SourceFolder"
dfolder = "C:\destFolder"
TempStore = "C:\LOG"
Set objFso = CreateObject("Scripting.FileSystemObject")
Set colfolder = objFso.GetFolder(sfolder)
Set objitem1 = colfolder.SubFolders
For Each objitem1 In colfolder.SubFolders
objFso.GetFolder objitem1
WScript.Echo objItem1.name
Compare(objItem1)
Next
Sub Compare(objItem1)
Set colfolder2 = objFso.GetFolder(dfolder)
Set objitem2 = colfolder2.SubFolders
For Each objitem2 In colfolder2.SubFolders
'WScript.Echo objitem2.name
objFso.GetFolder objitem2
If objitem2.name = objitem1.name Then
'WScript.Echo "No match for " & objitem2.name & " has been found"
'WScript.Echo " Next Folder"
Else
WScript.Echo "The folder " & objitem2.name & " is not on this share"
WScript.Echo "Copying folder " & objitem2.name & " to the Disaster Recovery" & _
" Server"
'objFso.GetFolder objitem2
'objFso.CopyFolder objitem2, tempStore, True
copyfolder(objitem2)
End If
Next
End Sub
Sub CopyFolder(objitem2)
MsgBox objitem2
objFso.CopyFolder objitem2, tempStore, True
End Sub


But am not sure am on the right path to solve the issue.

Please help me to solve this issue.

Thanks
Ehvbs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top