WebApp Sec mailing list archives

Re: Copying files from one server to another.


From: "David" <david () clicksee net>
Date: Thu, 24 Feb 2005 10:35:08 +0700

I worked doing release management and config management for 3 years at eCollege.com. Here is my advice;

You would be better off deploying any change to both servers at one time than pushing a file to the main server and then copying the file from the main server to the backup server.

You can use WinDiff to check to make sure your servers are in sync.

Otherwise you could set a task and just have it copy from A to B every night. Pretty easy script.

Here is a link to File System Object ref: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/FSOoriFileSystemObject.asp

If you don't have a config management tool like VSS or Perforce you should get one. VSS is a horrible horrible flawed and did I mention horrible? tool but better than nothing.

Use a simple script for deployment that will push to every place you need your stuff to go and aim for complete automation in deployment. File copying is the best place to start and registry updates can be easily added. Then go on to shutting down services, and restarting them and database updates. It may seem overblown now but as you expand you will appreciate it.You can go little by little.

Here is a link for VSS Automation if you are sick enough to use this tool:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvss/html/vssauto.asp

Moving and copying files via File System Object:
Moving, Copying, and Deleting Files
The FSO object model has two methods each for moving, copying, and deleting files, as described in the following table.

     Task Method
     Move a file File.Move or FileSystemObject.MoveFile
     Copy a file File.Copy or FileSystemObject.CopyFile
     Delete a file File.Delete or FileSystemObject.DeleteFile

The following example creates a text file in the root directory of drive C, writes some information to it, moves it to a directory called \tmp, makes a copy of it in a directory called \temp, then deletes the copies from both directories.

To run the following example, create directories named \tmp and \temp in the root directory of drive C:

[VBScript]
Sub ManipFiles
  Dim fso, f1, f2, s
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set f1 = fso.CreateTextFile("c:\testfile.txt", True)
  Response.Write "Writing file <br>"
  ' Write a line.
  f1.Write ("This is a test.")
  ' Close the file to writing.
  f1.Close
  Response.Write "Moving file to c:\tmp <br>"
  ' Get a handle to the file in root of C:\.
  Set f2 = fso.GetFile("c:\testfile.txt")
  ' Move the file to \tmp directory.
  f2.Move ("c:\tmp\testfile.txt")
  Response.Write "Copying file to c:\temp <br>"
  ' Copy the file to \temp.
  f2.Copy ("c:\temp\testfile.txt")
  Response.Write "Deleting files <br>"
  ' Get handles to files' current location.
  Set f2 = fso.GetFile("c:\tmp\testfile.txt")
  Set f3 = fso.GetFile("c:\temp\testfile.txt")
  ' Delete the files.
  f2.Delete
  f3.Delete
  Response.Write "All done!"
End Sub
[JScript]
function ManipFiles()
{
  var fso, f1, f2, s;
  fso = new ActiveXObject("Scripting.FileSystemObject");
  f1 = fso.CreateTextFile("c:\\testfile.txt", true);
  Response.Write("Writing file <br>");
  // Write a line.
  f1.Write("This is a test.");
  // Close the file to writing.
  f1.Close();
  Response.Write("Moving file to c:\\tmp <br>");
  // Get a handle to the file in root of C:\.
  f2 = fso.GetFile("c:\\testfile.txt");
  // Move the file to \tmp directory.
  f2.Move ("c:\\tmp\\testfile.txt");
  Response.Write("Copying file to c:\\temp <br>");
  // Copy the file to \temp.
  f2.Copy ("c:\\temp\\testfile.txt");
  Response.Write("Deleting files <br>");
  // Get handles to files' current location.
  f2 = fso.GetFile("c:\\tmp\\testfile.txt");
  f3 = fso.GetFile("c:\\temp\\testfile.txt");
  // Delete the files.
  f2.Delete();
  f3.Delete();
  Response.Write("All done!");
}Yours truly,

David Dockhorn
Web Editor
david () clicksee net

***************************************************************************************************
HostSearch.Com | DiscussHosting.Com | WebHostingMall.Com |

----- Original Message ----- From: "Eric Boughner" <eric () evenlink com> To: "'Sebastien Deleersnyder'" <sdl () ascure com>; <webappsec () securityfocus com>
Sent: Tuesday, February 22, 2005 8:01 PM
Subject: Copying files from one server to another.


Has anyone copied filed from one server to another for running a backup
server. I have 2 windows 2000 servers that are networked together. I would
like to make the one a running backup of the other server. Has anyone done
this before?

Eric







Current thread: