Jump to content

bytejunkie

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by bytejunkie

  1. pretty universal login script here... ' Get current username strUser = "" Do While strUser = "" strUser = objNetwork.UserName WScript.Sleep 100 Loop set objUser = GetObject("WinNT://CORPORATE/" & strUser &",User") ' Enumerate Group Membership strGroups = ";" For Each objGroup In objUser.Groups strGroups = strGroups & objGroup.Name & ";" Next ' the command MapGroup "Training", "T:", "\\SAN\Group$\Training" ' Uses the MapDrive function to map a network drive for a particular user group. ' Sub MapGroup(strGPName, strDrive, strShare) Const vbTextCompare = 1 If InStr(1, strGroups, strGPName, vbTextCompare) > 0 Then MapDrive strDrive, strShare End If End Sub
  2. i might need to explain recursiveness then. when you do this move, you need to write a script that goes. 1. move into folder. 2. enumerate folders 3. move into first folder 4. perform the action 5. repeat 3 and 4 for other folders this action of stepping through a tree of folders in called recursiveness. you are basically saying take me as deep as possible into the folder tree, perform the action, step back a level and do it again. so you actually end up moving the deepest folder first, then step up a level, work on that folder (or folders), then step up a level etc etc... found this vbscript - Question about recursively moving file - Stack Overflow look at the way the last line of the function calls itself. so it does its action, then calls itself for the subfolders. which is going to lead to performing the action at a lower level, then calling itself again. and again. until it runs out of subfolders. hope that makes sense, cos im not the best at explaining stuff in wording.
  3. i dont see a line where you're actually removing a folder. movefile wont remove folders, it will only remove the files. then you'll need to do a folder check for empty, something like count = fld.files then if count = 0 fld.delete if its not empty, then you're going to have to go all recursive and thats never fun. actually, this is the crux of the matter at hand, you're going to have to go recursive to move this. thats not valid vbs btw, ive not been in vbs for a looong time, been using python. at this point, i'd do one of two things. find somebody elses example of recursive file deletion/move to crib how its done. or i'd break out a copy of rsync and trigger an rsync job to do the move, which comes with the added benefit of logging verbosely so you know its working or why its not working... quick note as well. if you're going to be moving the user profile, im assuming a windows profile. i think there is a file something like ntdesktop.ini which will be a pain to move. also ntprofile.ini which i think holds the gp from last update. these live in the profile somewhere so watch out for them. another thing while im on, strDate isn't a date, its a path. sometimes it makes other peoples code easier to read if it makes sense.
×
×
  • Create New...