View Single Post
Old 01-26-06, 11:19 PM   #13 (permalink)
netsyd
Aximsite Veteran
 
netsyd's Avatar
 
Join Date: Nov 2005
Location: In my cube.
Posts: 1,516
Device: Apple iPhone
Carrier: Cingular
Thanked 0 Times in 0 Posts

Awards Showcase
Aximsite Active Bronze Member 
Total Awards: 1

Frenchy .... not sure this will help very much, but I wrote a script that will move my network share to my PC and vice versa. It utilizes Robocopy, but runs in VBScript, which I know is overkill (long story). The script should be fairly simple to modify to have it request the username and then migrate the files listed.

Here it is... sorry it's not exactly what you need, but it's what I've got :)
Code:
'========================================================================== 
' 
' VBscript Source File -- Created with SAPIEN Technologies Primalscript 4.0 
' 
' NAME: Robocopy.vbs 
' 
' AUTHOR: Brandon Steili , www.netsyd.com 
' DATE : 12/7/2005 
' 
' COMMENT: This script gives you the option of copying your my documents folder to 
' your network drive, or copying your network drive to your my documents folder. 
' The script requires Robocopy, and utilizes the /MIR /SEC switches. The only locations 
' you need to edit to suit your network are in the subfunction at the end of the 
' script. Username is determined automatically. There are a billion products that 
' could do this, but none of them did quite what we wanted... so here it is. 
' 
' 
' ==== Modification dates and users ==== 
' 
' 12/8/05 Initial writing of script 
' 
'========================================================================== 

Dim sourcedir,destinationdir,WshShell,Selection,robocopy,username 



Set WshShell = Wscript.CreateObject("Wscript.Shell") 
robocopy = """C:\Program Files\Resource Kit\robocopy.exe""" 
username = Wshshell.ExpandEnvironmentStrings("%USERNAME%") 

'Notify the user of the intentions 
MsgBox (("** IMPORTANT **") & VbCrLf & VbCrLf & ("The Windows Resource Kit MUST be installed in C:\Program Files\Resource Kit\")) 

'Get the user input for how to process 
Selection = InputBox (("** IMPORTANT **") & VbCrLf & VbCrLf & ("Please select the mirror you wish to process") & VbCrLf & VbCrLf & ( "Press 1-- to move files from local to network") &_ 
VbCrLf & VbCrLf & ("Press 2 -- to move files from network to local") & VbCrLf & VbCrLf & ( "Press 0 -- If you wish to quit") & VbCrLf & VbCrLf & (""), 65, "") 

If Selection = 0 Then 
Wscript.Quit 
Else 
' Call the sub to determine the source and destination directories 
SetFolders 

'Process the files 
WshShell.Run robocopy & " " & """" & sourcedir & """" & " " & """" & destinationdir & """" & " /MIR /SEC", , True 

If Err.Number <> 0 Then 
MsgBox ("** ERROR Received: **" & Err.number) 
Wscript.Quit 
Else 
Err.Clear 
End If 
End If 

MsgBox ("All Done. No Errors recieved.") 


Sub SetFolders 

Select Case Selection 
Case(1) 
sourcedir = "C:\documents and settings\" & username & "\My documents" 
destinationdir = "\SERVERNAME\Users\" & username 

Case(2) 
destinationdir = "C:\documents and settings\" & username & "\My documents" 
sourcedir = "\SERVERNAME\Users\" & username 

Case else 
MsgBox ("Invalid Seleciton. Exiting") 
Wscript.quit 

End Select 
End Sub
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Apple iPhone
O2 XDA Trion - WM6
T-Mobile SDA - WM6

Last edited by netsyd; 06-26-06 at 09:51 AM.
netsyd is offline   Reply With Quote