need a script for backup 
Author Message
 need a script for backup

I'm looking for someone who could write a small jscript for me.

The script should make a backup of all the files and folders place in the
directory "c:\Mes documents"  on the zip drive "E:"

could someone help ?
Laurent seghi

France



Sun, 18 Jul 2004 19:01:25 GMT  
 need a script for backup

Quote:

> I'm looking for someone who could write a small jscript for me.

> The script should make a backup of all the files and folders place in the
> directory "c:\Mes documents"  on the zip drive "E:"

> could someone help ?
> Laurent seghi

> France

Simple (thus preferred) way save next line as "backup.bat",
then run whenever needed:

xcopy "c:\Mes documents" "E:\Mes documents" /I /E /H /R /K /Q /Y

Better way (also one liner) - use robocopy.exe from Win2K RK with
/MIR switch - to copy/delete only differences.

Jscript way I:
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
var sMySrc = "C:\\Mes documents";
var sMyDest = "E:\\Mes documents";

oFSO.CopyFolder (sMySrc, sMyDest);
WScript.Echo("Done!");

JScript way II - create instance of file system object,
recursively loop through source's subfolders and files collection,
copying/deleting files on destination...

Branimir



Sun, 18 Jul 2004 22:51:59 GMT  
 need a script for backup

Quote:

> Jscript way I:
> var oFSO = new ActiveXObject("Scripting.FileSystemObject");
> var sMySrc = "C:\\Mes documents";
> var sMyDest = "E:\\Mes documents";

> oFSO.CopyFolder (sMySrc, sMyDest);
> WScript.Echo("Done!");

 it works fine but only once, or if the disk is blank.
it does'nt overwrite
Could you make it overwrite ?
laurent seghi


Mon, 19 Jul 2004 19:20:27 GMT  
 need a script for backup

Quote:

> > Jscript way I:
> > var oFSO = new ActiveXObject("Scripting.FileSystemObject");
> > var sMySrc = "C:\\Mes documents";
> > var sMyDest = "E:\\Mes documents";

> > oFSO.CopyFolder (sMySrc, sMyDest);
> > WScript.Echo("Done!");
>  it works fine but only once, or if the disk is blank.
> it does'nt overwrite
> Could you make it overwrite ?
> laurent seghi

If you look at docs:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/scri...

You will see this for CopyFolder method:

    object.CopyFolder ( source, destination[, overwrite] );

    object
    Required. Always the name of a FileSystemObject.

    overwrite
    Optional. Boolean value that indicates if existing folders are to be overwritten.
    If true, files are overwritten; if false, they are not. The default is true.

It implies that with third parameter set to 'true' same as without it
(since it is optional), CopyFolder method should overwrite destination.
But it does not (as you can see). Instead - better think of it as of
"CopyFolderOnlyOnce" method ;))

Seriously, the problem is with file attributes. Some of files/folders
that you copied first time have read only attribute set. CopyFolder
fails to overwrite such a file/folder regardless of overwrite flag value.

You could script around it by recursively resetting read only flags
on destination folder prior to calling CopyFolder method or - you
could go for shamefully simple - one liner DOS batch solution...

Branimir



Tue, 20 Jul 2004 01:03:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Need backup notification script - SBS 4.5

2. Need automate backup operation

3. Simple backup script question from a newbie

4. Test my backup script - anyone ?

5. Help with my backup script

6. Help with backup script

7. Backup/copy script

8. Backup files using script

9. backup script

10. Script Backup

11. backup up scripting

12. WinXPPro: Backup script wanted

 

 
Powered by phpBB® Forum Software