Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Find files are SYN or Not in Two Folders

Reply
 
Old 03-17-2009   #1 (permalink)
ashoksganesh


 
 

Find files are SYN or Not in Two Folders

Here wat am trying to acheive.

1) I have a Folder A and Folder B.
"
2)i want to check the files are sync in Folder A and Folder B,using
time frame

Now what am trying to do is

1)check the file in FolderA and grab the files from 9Am to 12 Pm go to
Folder B and find the file is exist or not.
2)This script should run every three hours to find the syn or non sync
between FolderA and Folder B files.

definitely there should be some easy way to do this,but i checked
different forum,i didn't get a right way to pursuit this,please help
me to
solve this issue.

Thanks in Advance


Here is the one i wrote just for count


****************************************************************
Dim oFS, SourceFolder,DestFolder,Source,Dest,demofolder,foldername
set oFS =CreateObject("Scripting.FileSystemObject")
set SourceFolder = oFS.GetFolder("c:\sourcefolder")
Set DestFolder=oFS.GetFolder("c:\destfolder")
foldername=demofolder.Name
Source= SourceFolder.Files.Count
Dest= DestFolder.Files.Count
If Source=Dest Then
WScript.Echo "SYNC"
Else
WScript.Echo "NON SYNC"
End if

******************************************************************

Not sure how to insert time frame in this script,please lead me.

Thanks

My System SpecsSystem Spec
Old 03-17-2009   #2 (permalink)
ekkehard.horner


 
 

Re: Find files are SYN or Not in Two Folders

ashoksganesh schrieb:
Quote:

> Here wat am trying to acheive.
>
> 1) I have a Folder A and Folder B.
> "
> 2)i want to check the files are sync in Folder A and Folder B,using
> time frame
>
> Now what am trying to do is
>
> 1)check the file in FolderA and grab the files from 9Am to 12 Pm go to
> Folder B and find the file is exist or not.
> 2)This script should run every three hours to find the syn or non sync
> between FolderA and Folder B files.
>
> definitely there should be some easy way to do this,but i checked
> different forum,i didn't get a right way to pursuit this,please help
> me to
> solve this issue.
>
> Thanks in Advance
>
>
> Here is the one i wrote just for count
>
>
> ****************************************************************
> Dim oFS, SourceFolder,DestFolder,Source,Dest,demofolder,foldername
> set oFS =CreateObject("Scripting.FileSystemObject")
> set SourceFolder = oFS.GetFolder("c:\sourcefolder")
> Set DestFolder=oFS.GetFolder("c:\destfolder")
> foldername=demofolder.Name
> Source= SourceFolder.Files.Count
> Dest= DestFolder.Files.Count
> If Source=Dest Then
> WScript.Echo "SYNC"
> Else
> WScript.Echo "NON SYNC"
> End if
>
> ******************************************************************
>
> Not sure how to insert time frame in this script,please lead me.
>
> Thanks
Have a look here:

http://www.visualbasicscript.com/fb.aspx?m=70412

You should be able to plug in a function that returns the same value
for all files that you consider the same; maybe the name and timestamp
will be enough.

My System SpecsSystem Spec
Old 03-17-2009   #3 (permalink)
ashoksganesh


 
 

Re: Find files are SYN or Not in Two Folders

On Mar 17, 11:31*am, "ekkehard.horner" <ekkehard.hor...@xxxxxx>
wrote:
Quote:

> ashoksganesh schrieb:
>
>
>
>
>
Quote:

> > Here wat am trying to acheive.
>
Quote:

> > 1) I have a Folder A and Folder B.
> > "
> > 2)i want to check the files aresyncin Folder A and Folder B,using
> > time frame
>
Quote:

> > Now what am trying to do is
>
Quote:

> > 1)check thefilein FolderA and grab the files from 9Am to 12 Pm go to
> > Folder B andfindthefileis exist or not.
> > 2)This script should run every three hours tofindthe syn or nonsync
> > between FolderA and Folder B files.
>
Quote:

> > definitely there should be some easy way to do this,but i checked
> > different forum,i didn't get a right way to pursuit this,please help
> > me to
> > solve this issue.
>
Quote:

> > Thanks in Advance
>
Quote:

> > Here is the one i wrote just for count
>
Quote:

> > ****************************************************************
> > Dim oFS, SourceFolder,DestFolder,Source,Dest,demofolder,foldername
> > set oFS =CreateObject("Scripting.FileSystemObject")
> > set SourceFolder = oFS.GetFolder("c:\sourcefolder")
> > Set DestFolder=oFS.GetFolder("c:\destfolder")
> > foldername=demofolder.Name
> > Source= SourceFolder.Files.Count
> > Dest= DestFolder.Files.Count
> > If Source=Dest Then
> > WScript.Echo "SYNC"
> > Else
> > WScript.Echo "NONSYNC"
> > End if
>
Quote:

> > ******************************************************************
>
Quote:

> > Not sure how to insert time frame in this script,please lead me.
>
Quote:

> > Thanks
>
> Have a look here:
>
> * *http://www.visualbasicscript.com/fb.aspx?m=70412
>
> You should be able to plug in a function that returns the same value
> for all files that you consider the same; maybe the name and timestamp
> will be enough.- Hide quoted text -
>
> - Show quoted text -
Hi ekkehard,

Thanks for your immediate reply and poit out the path to get some
idea.

EHVBS is my fav programmer in VBScript forum,he helped me a lot though
but this time i don't see him.

As per my idea based on EHVBS script it will compare file after "_"
text (ex: XYZ_XYZ1.txt) it will get XYZ1 and compare.

1) I have a file come thru webportal.and copy the file in FOLDEER A
named as "PX_ZZWC1801_2_03112009_115128_439_HS00140.TXT_1.TXT
"
2)The same file copied to FOLDEER Bin 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 FOLDEER B

First part :"PX_ZZWC1801_1_03112009_115127_140
Second Part:_PX_ZZWC1801_2_03112009_115128_439_HS00140.TXT_1 .txt

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

So how can i modify his script based on my file name ?

Thanks
My System SpecsSystem Spec
Old 03-17-2009   #4 (permalink)
Paul Randall


 
 

Re: Find files are SYN or Not in Two Folders


"ashoksganesh" <ashoksganesh@xxxxxx> wrote in message
news:329799c3-5728-4bc3-93b1-c0d8e61cb942@xxxxxx
Quote:

> Here wat am trying to acheive.
>
> 1) I have a Folder A and Folder B.
> "
> 2)i want to check the files are sync in Folder A and Folder B,using
> time frame
>
> Now what am trying to do is
>
> 1)check the file in FolderA and grab the files from 9Am to 12 Pm go to
> Folder B and find the file is exist or not.
> 2)This script should run every three hours to find the syn or non sync
> between FolderA and Folder B files.
>
> definitely there should be some easy way to do this,but i checked
> different forum,i didn't get a right way to pursuit this,please help
> me to
> solve this issue.
>
> Thanks in Advance
>
>
> Here is the one i wrote just for count
>
>
> ****************************************************************
> Dim oFS, SourceFolder,DestFolder,Source,Dest,demofolder,foldername
> set oFS =CreateObject("Scripting.FileSystemObject")
> set SourceFolder = oFS.GetFolder("c:\sourcefolder")
> Set DestFolder=oFS.GetFolder("c:\destfolder")
> foldername=demofolder.Name
> Source= SourceFolder.Files.Count
> Dest= DestFolder.Files.Count
> If Source=Dest Then
> WScript.Echo "SYNC"
> Else
> WScript.Echo "NON SYNC"
> End if
>
> ******************************************************************
>
> Not sure how to insert time frame in this script,please lead me.
>
> Thanks
It is relatively easy to script checking that all files that exist in
sourcefolder also exist in destfolder, and maybe you would also have to
verify that all files in dest folder also exist in source folder. This does
not mean that the files are identical, only that they exist.

Perhaps you need some way to verify the files are actually the same.
Microsoft has a tool to help with this task.
http://www.microsoft.com/downloads/d...displaylang=en
FCIV is a command line tool which can produce SHA1 or MD5 checksums for all
the files in a folder and its subfolders. Alternately, it can produce an
XML-formatted text file with checksum info. Later, FCIV can then use this
XML file as input when the tool is used to verify that everthing listed in
the XML file exists identically in the original or some other folder. The
script could be set up to read STDOUT while the command line is executed,
and and report any problems.

If you are interested in this, post a reply here and I will clean up and
post a sample script.

-Paul Randall


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
How to find folders by date? Vista file management
How to count the total files under c:\abc\<* folders>\out where <* folders> are many folders? PowerShell
I can't find the Folders of other languages !! Vista installation & setup
Search for files and folders doesn't find system files Vista General
Where to find my old files and folders Vista file management


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46