Hi,

Can anyone please help to provide a script to search for a file in some folders and then copy to other folder.

For example ..search for winword.exe in below mentioned folder...

C:\Program Files\Microsoft Office\Office

C:\ Program Files\Microsoft Office\Office11

C: Program Files\Microsoft Office\Office12

And once winword.exe is found ..copy it to below folder:

C: Program Files\Microsoft Office\Office14

Many Thanks,
DJ

PS: Ian please ingore this message.... I know I am expecting this help in free...I believe someone will be able to help...[8D]
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
It's not so much that you want it for free but that you seem incapable of using a search engine. There must be a quadzillion example scripts showing how to recursively search a folder for a file.
Answered 09/14/2010 by: VBScab
Red Belt

Please log in to comment
0
Any help please...
Answered 09/14/2010 by: djain3
Second Degree Blue Belt

Please log in to comment
0
all you need is the filesystemobject methods
have a look at this LINK
Answered 09/14/2010 by: cygan
Fifth Degree Brown Belt

Please log in to comment
2

Set oShell = CreateObject("Wscript.Shell")
prgFile = oShell.ExpandEnvironmentStrings("%PROGRAMFILES%")
CtxFile=prgFile & "\Microsoft Office\Office\winword.exe"
CtxFile1=prgFile & "\Microsoft Office\Office11\winword.exe"
CtxFile2=prgFile & "\Microsoft Office\Office12\winword.exe"
DestinationFileLocation=prgFile & "\Microsoft Office\Office14\"

Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(ctxFile) And objFSO.FileExists(ctxFile1) And objFSO.FileExists(ctxFile2) Then

objFSO.CopyFile ctxFile,DestinationFileLocation
OverwriteExisting

objFSO.CopyFile ctxFile1,DestinationFileLocation
OverwriteExisting


objFSO.CopyFile ctxFile2,DestinationFileLocation
OverwriteExisting

End If
Set objFSO = nothing




play around with this ,I have not tested this in any shape or form
really basic but this can give you some clues
Answered 09/14/2010 by: cygan
Fifth Degree Brown Belt

Please log in to comment
0
Many Thanks Cygan....I have given you score for your help...[:)]
Answered 09/15/2010 by: djain3
Second Degree Blue Belt

Please log in to comment
0
c'mon now vb you can't expect supermember djain3 to use a search engine
and, I'm sure that there must be a legitimate reason for using vbscript instead of the standard windows installer tables! [:D]
Answered 09/15/2010 by: aogilmor
Ninth Degree Black Belt

Please log in to comment
0
Fair dos...it might not be part of an install? But then, wouldn't the poster have used the 'Scripting' forum?
Answered 09/15/2010 by: VBScab
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity