troubleshooting Question

Checking if Folder Exists and updating a file

Avatar of Lee
LeeFlag for United States of America asked on
VB Script
5 Comments1 Solution446 ViewsLast Modified:
Hi All,
I am not very good at all with scripting, so I could use some assistance. I have tried to take a few different scripts I have seen and then attempted to mash them together in hopes of something that would work!

I am looking to make a simple script that once it is executed it will look for a folder, if the folder exists then I need to have it copy a file to that location. The file will be in the same place the script is. I am not total sure I would what a message box to pop up or not – if so maybe have a countdown to auto close it? I would like to make this script so it is not interactive – that take out the question of the users doing something that was not expect.

So my question – how do I tell a file copy to snag the file from te4h same folder the script is in? The next question would I show some time of progress? My overall goal is to push profile updates out to users Cisco clients.


Thanks!

What I have so far...

        Dim objFSO
        
        objFSO = CreateObject("Scripting.FileSystemObject")
        If objFSO.FolderExists("C:\ProgramData\Cisco\Cisco AnyConnect Secure Mobility Client\Profile") Then
            objFSO.CopyFile "C:\MyTestFile.txt", "C:\ProgramData\Cisco\Cisco AnyConnect Secure Mobility Client\Profile"            
        ElseIf objFSO.FolderExists("C:\Documents and Settings\All Users\Application Data\Cisco\Cisco AnyConnect Secure Mobility Client\Profile") Then
            objFSO.CopyFile "FILE...", "C:\Documents and Settings\All Users\Application Data\Cisco\Cisco AnyConnect Secure Mobility Client\Profile"            
        Else
            MsgBox("Profile Location doesn't exists!")
        End If
ASKER CERTIFIED SOLUTION
Robberbaron (robr)

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros