Link to home
Start Free TrialLog in
Avatar of RichardRiga
RichardRiga

asked on

Using VBScript and FileSystemObject, can I use relative paths to copy files from one folder to another?

Hello, I have the following directory structure:

C:\
    - TestSource
           FileToBeCopied.xxx
    - TestDestination
    TestCopyFile.vbs
   
I call the TestCopyFile.vbs with cscript from a DOS prompt and the .vbs contains the following:

dim objFSOPatch, testPath

tDest = ".\TestDestination\"

set objFSOPatch = CreateObject("Scripting.FileSystemObject")
objFSOPatch.CopyFile ".\TestSource\FileToBeCopied.xxx", tDest, True

set fso=Nothing

However, this does not appear to work.  Can I not use relative pathing for this?  Can someone make the change that will fix this for me, please?

Thank you!
Avatar of HyperBPP
HyperBPP

ASKER CERTIFIED SOLUTION
Avatar of HyperBPP
HyperBPP

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RichardRiga

ASKER

Hyper, that first link i'd already looked at and tried to emulate but haven't gotten to work.
The second one only mentions that it is possible to use a relative path but shows no example for it specifically.  What am I doing wrong in MY example?
lol ok i posted that last while you posted that second. i'll check it out now thanks
Thanks so much, that helped a ton.