Резервная копия папки на сервер

param($source, $destination, $help)

function funHelp()
NAME: BackupFolderToServer.ps1 
Backes up files in a folder to a mapped drive. The destination
folder does not have to be present

-source      the source of the files and folders
-destination where the files are to be copied
-help        prints help file

BackupFolderToServer.ps1 -source c:\fso -destination h:\fso

Backs up all files and folders in c:\fso on local machine to
a mapped drive called h. The \fso folder does not need to 
exist on the h:\ drive.


generates an error. the -source and -destination parameters
must be present

BackupFolderToServer.ps1 -help ?

Displays the help topic for the script


if($help){ "Obtaining help ..." ; funhelp }

if(!$source -or !$destination) 
    $(throw "You must supply both source and destination.
	 Try this BackupFolderToServer.ps1 -help -?") 
Copy-Item -Path $source -destination $destination -recurse

Также интересно:

Голосов пока нет

Оставить комментарий