Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Moving Files with VB Script

Posted on 2011-10-10
Medium Priority
Last Modified: 2012-05-12

I want to move files between directories within a small vb script.
If I specify the directory and filename the move works fine, but not when I try to use variables.

        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set TransferFile = objFSO.GetFile(strFullFilePath)
        objFSO.MoveFile "C:\Program Files\Bitvise Tunnelier\update091011.txt", "c:\NewLocation\"

This works, but when I use the following it fails :-

          objFSO.MoveFile "TransferFile", "c:\IVR\"

No error message the file is just not copied.
Question by:HRMorton
  • 2
LVL 39

Expert Comment

by:Pratima Pharande
ID: 36941924
remove "

objFSO.MoveFile  TransferFile, "c:\IVR\"
LVL 39

Accepted Solution

Pratima Pharande earned 2000 total points
ID: 36941928
 Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set TransferFile = objFSO.GetFile(strFullFilePath)
        objFSO.MoveFile TransferFile, "c:\IVR\"

Author Closing Comment

ID: 36941952
So simple, but worked perfectly.
Thanks for the help.

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question