Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script to copy files / subfolder to a local drive then back again! 1

Status
Not open for further replies.

colinmitton

Technical User
Feb 24, 2005
190
GB
I need to add a couple of scripts to my GPO's for logon and logoff.

I need to copy from K:\templates\%username%\
All files and subfolder with all files within. to the local drive:
C:\templates

Then another script to for logging off to copy all files \ sub-folders from my c:\templates back to the k:\templates\%usersname% area.

I have somewhere between little and no knowledge of VBS, with help from folks like yourself I've got a little knowledge so understand that this should be straight forward (I think).

I've copied named files but nothing that would need dynamic reference like 'username' from Active Directory.

For your reference I need to copy my Word 2010 templates from the server to the PC and then back up to the server on logging off so the templates are in an area thats backed up and safe!
 
A .BAT file may be better for this task (Untested, conceptual)

Logon.bat
xcopy -a -c k:\templates\%username% c:\templates

Logoff.bat
xcopy -a -c c:\templates k:\templates\%username%


-Geates
 
you will probably want to include
Code:
@echo off
at the top of the .bat file to surpress output. Oh, and a /y at the end of the xcopy to surpress confirmation prompts.

-Geates
 
Thanks for that, I did think that with logon / logoff scripts used I could not use a bat file. If I can use a batch then it a piece of cake. I'll give it a try tomorrow when I'm back in the office.
 
The bat file do work!! thank goodness...

Simple one line solution and works a treat!

Thanks Geates
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top