Jump to content

Recommended Posts

Posted

So here's the deal.

 

I have a Small Business Server (2008) server, and I have multiple laptops connected to the server (sometimes connected...When the users are in the office!). We have some software on the server and laptops that is a database sytem that as part of it's function runs and prints reports. To run these reports I need specific files on each laptop that are located at C:\Users\Username\Documents\SoftwareName\RPTFiles\REPORT. The .rpt files that reside in this folder on each laptop need to periodically be updated. At the moment we go around each laptop and drop them in individually via a flash drive.

 

There has to be an easier way to push these out to all machines...I just can't remember how! So can anybody help? I've been away from the game for a while, so bare with me if it's a silly question!

Posted
Could this be a GPO with a batch file - you could specify the files on the server and where you want them copied. This could either be a startup or login script. You could simple add another copy line into one batch file each time a new file needs copying - you could override or skip the existing files.
  • Thanks 1
Posted

Is there much difference between IF EXIST and XCOPY?

 

After reading your posts it got me digging some more....So, would this work (I can't get to my server to test for a few days!)

 

XCOPY "g:\Calvin\RPTFiles\REPORT" "%public%\Documents\Calvin\RPTFiles\REPORT" /d /y

 

Where g: is a location on the server.

 

Can I use "public" or would it need to be "alluserprofiles", or something else? Or am I barking up the wrong tree completely?!

Posted

I've not been able to do any testing today, so did a bit more research and wanted to see what you though...

 

So I want the logon script to check the source and destination folders, if there have been any changes to the source folder (amendments to files, new files added, old files deleted). I want these changes reflected in the destination folder.

 

Source (Server): G:\Calvin\RPTFiles\REPORT

Destination (PC/Laptop): %public%\Documents\Calvin\RPTFiles\REPORT

 

if exist %destination% goto GO

:GO

mkdir %destination%%yyyymmdd1%

xcopy %source%* %destination% /s/d/y/c/v/r

echo.

echo Finished copying %source% to %destination%

echo.

echo Created %destination%%yyyymmdd1%

pause

 

Does that look about right, or am I barking up the wrong tree?

Posted (edited)

Testing done! And the copying side worked a treat...Thanks guys.

 

I used the following:

XCOPY "G:\Calvin Files\RPTFiles (Originals)" "%USERPROFILE%\Documents\Calvin#\RPTFiles" /d/s/y

 

But (there's always a "But"!) what about deleted files? I've got it so that it will copy any new files, and copy across any amended files, but what about if I purposely delete a file from "G:\Calvin Files\RPTFiles (Originals)"? At the moment it still keeps the 'old' file that I want deleted in the "%USERPROFILE%\Documents\Calvin#\RPTFiles" location.

 

I suppose what I'm looking for is a 'Clone' of a folder, rather than a 'Backup'. To be honest, it's not a big deal, as initially we just want to deploy these files onto our user machines, and make amendements. We may not even need to delete files. It's just when I was testing, I was adding/amending/removing a test file and the 'remove' part didn't work!

Edited by gloriousglenn
Posted

So it would be a delete followed by a copy...Makes sense! I'm a scripting novice so bear with me! I did a search and found something that I've adapted...Do you think this would work?

 

cd "%USERPROFILE%\Documents\Calvin#\RPTFiles"

 

del *.* /F /S /Q /A: R /A: H /A: A

 

rmdir /s /q "%USERPROFILE%\Documents\Calvin#\RPTFiles"

 

XCOPY "G:\Calvin Files\RPTFiles (Originals)" "%USERPROFILE%\Documents\Calvin#\RPTFiles" /d/s/y

Posted (edited)

That link is awesome...thanks! Something for me to play with tomorrow!

 

I did some digging and I found this:

https://social.technet.microsoft.com/wiki/contents/articles/1073.robocopy-and-a-few-examples.aspx

 

Mirror a directory with subfolders incl. empty directories

/MIR is an option to ROBOCOPY where you mirror a directory tree with all the subfolders including the empty directories and you purge files and folders on the destination server that no longer exists in source.

 

ROBOCOPY \\sourceserver\share \\destinationserver\share /MIR

Or

 

ROBOCOPY source-drive:\DIR destination-drive:\DIR /MIR

 

So I'm going to try this tomorrow:

Robocopy G:\Calvin Files\RPTFiles (Originals) %USERPROFILE%\Documents\Calvin#\RPTFiles /MIR

Edited by gloriousglenn
Extra information
Posted

I ended up using:

 

Robocopy "G:\Calvin Files\RPTFiles (Originals)" "%USERPROFILE%\Documents\Calvin#\RPTFiles" /MIR /FFT /Z /XA:H /W:5

 

Thanks so much rpettit and Galway. I couldn't have done it without you.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...