vbs script to copy folders

April 6, 2010 at 07:05:39
Specs: Windows XP, 2.0 GHz, 512MB
I need a vbs script I can use to copy folders the same way I use the script below to copy files. I would appreciate it if anyone could help.

On Error Resume Next
Const OverwriteExisting = True
Set objArgs = WScript.Arguments
Set objFSO = CreateObject("Scripting.FileSystemObject")

If objArgs.Count < 1 Then
    MsgBox "Thanks but.. Wrong!!" & vbCRLF & _
           "" & vbCRLF & _
           "Select a file in Explorer, drag and drop it on the script." & vbCRLF & _
           "Or place a shortcut from the script into the SendTo folder" & vbCRLF & _
           "This way the script will show in the sendto right click menu ." & vbCRLF & _
           "" & vbCRLF & _
           "To edit the sendto menu go to 'Start - Run - Sendto - OK" & vbCRLF & _
           "Place the shortcut from DropFile.vbs in the SendTo folder, now right click a file and 'Send To'DropFile", _
           vbInformation + vbOKOnly, Title
    WScript.Quit
End If


For I = 0 to objArgs.Count - 1

   Arg = objArgs(I)
  
   objFSO.CopyFile Arg, "D:\0 aAPPS\00 a Install First\00 ICONS\System Folders\", OverwriteExisting
   objFSO.CopyFile Arg, "N:\0 aAPPS\00 a Install First\00 ICONS\System Folders\", OverwriteExisting
   objFSO.CopyFile Arg, "X:\0 aAPPS\00 a Install First\00 ICONS\System Folders\", OverwriteExisting
   objFSO.CopyFile Arg, "W:\WINDOWS\system32\00 ICONS\System Folders\", OverwriteExisting
   objFSO.CopyFile Arg, "E:\WINDOWS\system32\00 ICONS\System Folders\", OverwriteExisting
   objFSO.CopyFile Arg, "F:\0 aAPPS\00 a Install First\00 ICONS\System Folders\", OverwriteExisting
   objFSO.CopyFile Arg, "G:\WINDOWS\system32\00 ICONS\System Folders\", OverwriteExisting
   objFSO.CopyFile Arg, "H:\0 aAPPS\00 a Install First\00 ICONS\System Folders\", OverwriteExisting
   objFSO.CopyFile Arg, "J:\WINDOWS\system32\00 ICONS\System Folders\", OverwriteExisting
   objFSO.CopyFile Arg, "K:\0 aAPPS\00 a Install First\00 ICONS\System Folders\", OverwriteExisting

Next
WScript.Quit

I know very little script writing. The script above was given to me I only edited it to include the paths to my folders. I would like to be able to drag and drop a folder on to a script to copy it to several drives.


See More: vbs script to copy folders

Report •


#1
April 6, 2010 at 13:00:41
SIMPLE SOLUTION!

I found all I had to do was replace "objFSO.CopyFile Arg" with "objFSO.CopyFolder Arg"
in the script above.

Report •
Related Solutions


Ask Question