VBscript to search in folders and copy to other folder
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]
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
Answers (7)
Please log in to answer
Posted by:
cygan
14 years ago
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
Posted by:
anonymous_9363
14 years ago
Fair dos...it might not be part of an install? But then, wouldn't the poster have used the 'Scripting' forum?
Posted by:
anonymous_9363
14 years ago
Posted by:
aogilmor
14 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.