VBScript - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Microsoft Windows and Software
Click Here to Login
Closed Thread
Thread Tools Display Modes
Old 02-16-2005, 04:49 AM   #1 (permalink)
Newb Techie
Join Date: Feb 2005
Posts: 24
Default VBScript

Hi all,

Seens as nobody had a clue on how to fix my last problem "including myself" i decided to let it go...

However with the helpof another forum we came up with a script that will do the job for us... Horay ...

So now i have a VBScript that semi does the job i want it to i was wondering if anyone wanted to help me adapt it to do exactly what i need it to do.

here is a copy of the script from a user on another forum:

Option Explicit

Dim fso, src, dest
Set fso = CreateObject("Scripting.FileSystemObject")
src = "C:\2"
dest = "C:\3"

If fso.FolderExists(src) Then
If Not fso.FolderExists(dest) Then
End If
WScript.Echo "Folder: """ & src & """ doesn't exist."
End If

Function getSubFolders(node)
Dim root, folder, newRoot, file, srcPath, destPath
Set root = fso.GetFolder(node)
For Each file In root.Files
srcPath = fso.BuildPath(node,file.Name)
destPath = fso.BuildPath(dest,file.Name)
If Not fso.FileExists(destPath) Then
WScript.Echo "Copying """ & srcPath & """ to """ & destPath & """"
fso.CopyFile srcPath, destPath, True
WScript.Echo "Error: """ & destPath & """ already exists."
End If
For Each folder In root.SubFolders
'WScript.Echo folder.Name
End Function

This script works amazingly well, however i need it ammended slightly to work perfectly and i am not fantastic with VBScripts..

What the script does is copys the files in a directory over to a new directory, however it does not include the sub-directory's of the source folder... It does however copy the files in the sub-directorys.

What i want the script to do is to copy the sub directorys as well, basically i want it to copy the entire folder, sub-folders, files, everything. so i presume only slight ammendments are required... Hopwfully...

so if anyone knows how to add that in please post an annmendment and ill be very grateful....
TheElise is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 04:49 PM.

Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.