Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


CopyFolder Method

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,59356
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> CopyFolder Method
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 CopyFolder Method - 4/22/2008 3:41:04 AM   
  ztruelove

 

Posts: 2
Score: 0
Joined: 3/2/2008
Status: offline
I am trying to use a vbscript on an XP machine to copy a particular folder into each profile under "Documents and Settings."  Below is a script that I wrote trying to accomplish that...

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
'On Error Resume Next

Const USERPROFILE = 40
Dim objShell, objFSO, objUser, objDocsAndSettings, objUserProfile
Dim sUserProfile

Set objShell = CreateObject("Shell.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")

sUserProfile = objShell.Namespace(USERPROFILE).self.path

Set objUserProfile = objFSO.GetFolder(sUserProfile)

Set objDocsAndSettings = objFSO.GetFolder(objUserProfile.ParentFolder)

For Each objUser In objDocsAndSettings.SubFolders
    objFSO.CopyFolder "C:\Documents and Settings\All Users\Start Menu\Programs\Ipswitch WS_FTP Professional", _
    objUser.Path & "\Start Menu\Programs\Ipswitch WS_FTP Professional"
Next
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

The problem is that the CopyFolder method isn't recognizing the destination since it includes objUser.Path.  Again, I can get the basic functionality of the method to work fine; the problem arises from the fact that I need to perform this copy on each and every profile under "Documents and Settings."  Any suggestions on how to accomplish what I'm looking for?
 
 
Post #: 1
 
 RE: CopyFolder Method - 4/22/2008 4:25:24 AM   
  Country73


Posts: 710
Score: 8
Joined: 8/25/2004
From: USA
Status: offline
Make sure you echo out the CopyFolder & Destination to make sure it is hitting the right paths.
Generally this is the part that usually messes things up.

(in reply to ztruelove)
 
 
Post #: 2
 
 RE: CopyFolder Method - 4/22/2008 4:34:21 AM   
  ztruelove

 

Posts: 2
Score: 0
Joined: 3/2/2008
Status: offline
Found the problem.  The script was dying when it hit the Local Service profile.  So much for my debugging skills.   ;-)

Thanks for the assist!

(in reply to Country73)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> CopyFolder Method Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts