Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Newbie - Copy data script

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Newbie - Copy data script
  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 >>
 Newbie - Copy data script - 7/9/2007 1:36:19 AM   
  Apex_Pirate

 

Posts: 3
Score: 0
Joined: 7/9/2007
Status: offline
Hey Guys,
Newbie here.  Just took a scripting class and now I'm on a project at work trying to use my new (very new) skills.  I have a scenario where i need to copy certain folders from a Fujitsu tablet to a location on the network.  Then i'll reimage the tablet and copy what is on the network back into place.  I have 89 of these to do in 60 hours.  I have perused the internet and found some scripts and edited them.  In detail, I'm trying to map to a network location, then create a folder in that location called the same thing as the username, copy the c:\data folder as well as the user's favorites and desktop folders over to the newly created folder.  I wanted a progress bar as sometimes there will be gigs worth of data and I want to know when it is finished.  Once done I would re-image the machine and then execute another script (which I have not created yet) to go the the current user's folder on the network and copy the data back into the original locations. 

As you can imagine, me being a newbie, I am running into some problems.  The script I have is below.  It performs pretty nicely but it does not do a few things.  One is that after it maps the network drive it does not create a unique folder based on the currently logged in username.  The c:\data is copied over to the network drive but that is all that is copied over.  The data, favorites and desktop folders should all be copied over and placed in the unique "username" folder (where "username" is the currently logged in user).  What am I missing?  Any help would be greatly appreciated!

'----- Copy files --------
On Error Resume next
Const FOF_CREATEPROGRESSDLG = &H10&
Dim ParentFolder, objShell, objFolder, objNet, strName
Set objNet = CreateObject("Wscript.Network")
strName = objNet.UserName
objNet.MapNetworkDrive "G:", "\\server\share\User Data"
WScript.Sleep 5000
ParentFolder ="g:\"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(ParentFolder)
objFolder.CopyHere "C:\data", FOF_CREATEPROGRESSDLG
MsgBox ("Transfer Completed Succesfully")
'===============================================================================================================================
Const ForAppending = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const OverWriteFiles = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFolder "C:\Data" , "G:\" , OverWriteFiles
objFSO.CopyFolder "C:\Documents and Settings\ & strName & \Favorites" , "G:\" , OverWriteFiles
objFSO.CopyFolder "C:\Windows\Application Data\Microsoft" , "G:\" , OverWriteFiles
objFSO.CopyFolder "C:\Documents and Settings\ & strName & \Desktop" , "G:\" , OverWriteFiles
'================================================================================================================================
 
 
Post #: 1
 
 RE: Newbie - Copy data script - 7/9/2007 2:08:40 AM   
  Apex_Pirate

 

Posts: 3
Score: 0
Joined: 7/9/2007
Status: offline
Ok, I've added one line to my script.  It's highlighted.  This addition created the folder on the network share and named it the username that I am logged in as.  Awesome!  But the data still copies to the networkn share and not into the newly created folder.  Bummer.  Any hints?  I'll keep searching on my own as well.  It still doesn't copy the other two (desktop and Favorites).  Any help there would also be nice.  Thanks!

'----- Copy files --------
On Error Resume next
Const FOF_CREATEPROGRESSDLG = &H10&
Dim ParentFolder, objShell, objFolder, objNet, strName
Set objNet = CreateObject("Wscript.Network")
strName = objNet.UserName
objNet.MapNetworkDrive "G:", "\\server\share\User Data"
WScript.Sleep 5000
ParentFolder ="g:\"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(ParentFolder)
objFolder.NewFolder strName
objFolder.CopyHere "C:\data", FOF_CREATEPROGRESSDLG
MsgBox ("Transfer Completed Succesfully")
'===============================================================================================================================
Const ForAppending = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const OverWriteFiles = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFolder "C:\Data" , "G:\" , OverWriteFiles
objFSO.CopyFolder "C:\Documents and Settings\ & strName & \Favorites" , "G:\" , OverWriteFiles
objFSO.CopyFolder "C:\Windows\Application Data\Microsoft" , "G:\" , OverWriteFiles
objFSO.CopyFolder "C:\Documents and Settings\ & strName & \Desktop" , "G:\" , OverWriteFiles
'================================================================================================================================

(in reply to Apex_Pirate)
 
 
Post #: 2
 
 RE: Newbie - Copy data script - 7/9/2007 3:02:26 AM   
  Country73


Posts: 732
Score: 10
Joined: 8/25/2004
From: USA
Status: offline
objFSO.CopyFolder "C:\Data", "G:\" & strName & "\", OverWriteFiles

(in reply to Apex_Pirate)
 
 
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 >> Newbie - Copy data script 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