deathmage Posted January 12, 2014 Share Posted January 12, 2014 (edited) Hello, I'm curious if there is a batch file that can be made to move the contents that are setup like this.... I'm having to redo a TS cluster and I'd like to make a batch file script that can be executed that moves the contents of say 'jsmith's local desktop profile @ \\NGTTS1\users\jsmith to a centralized folder on our roaming desktop profile server that saves all of the files for the desktops @ \\NGTFS1\users\jsmith. The problem I have is no matter what I tell users to save there files to our Y drive that is a folder that is synced across all 6 of our TS servers, users still store files on there desktops, so as you can imagine if one day they are on one server, then next day they could be on another and there files aren't the same.... hence the reason why I want to move all there files to the centralized server so when I redo the profiles from scratch on the TS server in the farm they suck files from the core server and have all of the files they are used to having.... Now I know I can do this with a MOVE command I've just never done one to this exact. Hopefully someone knows the command to move all the contents of one folder on one server to the folder on a different server. I've already got the bulk of the coding done of the .bat script I just don't know this move command: would it be this: move \\NGTTS1\users\jsmith *.* \\NGTFS1\users\jsmith any help would be appreciated, I'm sure this is a easy command to do! Also what I'd like to do if force the copy of the files even if the some of the files are duplicates and just copy over them or skip them, just not sure how to do this.... This is what I got so far for coding: @echo offcolor 0Atitle Moving Local Profile folder to Centralized Profile Folder on Core Server. :startecho Welcome, %USERNAME%echo What would you like to do?echo.echo 1. Moving Local Profile folder to Centralized Profile Folder on Core Serverecho. echo 0. Quitecho. set /p choice="Enter your choice: "if "%choice%"=="1" goto Move-user-profilesecho.if "%choice%"=="0" exitecho Invalid choice: %choice%echo.pauseclsgoto start :Move-user-profilesecho.set /p profile="Enter user profile: "move "\\NGTTS1\users\%profile%" *.* "\\NGTFS1\users\%profile%"echo moving files from local profile folder to FS1 profile server, stand-by...echo.goto cancel-special :cancel-specialset /p cancel="Type cancel to stop action: "if not "%cancel%"=="cancel" exitclsecho Action is cancelled.echo. pauseexit Edited January 12, 2014 by deathmage Link to comment Share on other sites More sharing options...
gunsmokingman Posted January 13, 2014 Share Posted January 13, 2014 Here is a VBS script that will move only files that do not exists on the other computer and reports the results in a self closing messagebox. There is no user input and you can not cancelNoteThis make the folder where the script resides for the objectFso.GetFolder(".").FilesTo use another folder just put a path in between the quotes exampleFso.GetFolder("Drive:\Folder\SomeName").FilesThis is to make sure the VBS script does not get moved to the other folderIf Not LCase(Obj.Path) = LCase(WScript.ScriptFullName) Then This make sure that files does not get moved to the other folder if it existsIf Fso.FileExists("\\HOMEBETAVISTA\VistaHomeBeta\" & Obj.Name) Then'-> This code is property of Gunsmokingman and Or Jake1Eye and you must have his permission to use.'-> This is only posted as example code and meant only to used as such.Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")Dim Obj, Var For Each Obj In Fso.GetFolder(".").Files If Not LCase(Obj.Path) = LCase(WScript.ScriptFullName) Then If Fso.FileExists("\\HOMEBETAVISTA\VistaHomeBeta\" & Obj.Name) Then Var = Var & "File Exists : \\HOMEBETAVISTA\VistaHomeBeta\" & Obj.Name & vbCrLf Else Var = Var & "Move File : \\HOMEBETAVISTA\VistaHomeBeta\" & Obj.Name & vbCrLf Fso.MoveFile Obj.Path, "\\HOMEBETAVISTA\VistaHomeBeta\" & Obj.Name End If End If Next CreateObject("Wscript.Shell").Popup "Script Completed" & vbCrLf & Var ,30,"Move Completed",4128 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now