Copy to Web Folder

Copy local file to WebDAV (Web Folder).

/**
 * Copy local file to WebDAV (Web Folder).
 * Note: Don't use forward slashes in paths
 * @usage
 *     Copy2WebFolder.js file.ext web_folder[\remote\path]"
 *
 *    web_folder -    Web Folder name for WebDAV server in 
 *            'My Network Places' (NetHood) folder
 * @author    dMitry Alexandrov <dmitry.alexandrow@gmail.com>
 * @since    2008-09-27
 */
 
var args = WScript.Arguments.Unnamed;
 
if (args.length <2)    // Usage:
    WScript.Quit(WScript.Echo(
        "Copy local file to Web Folder (WebDAV)\n\n"+
        "Usage:\n"+
        WScript.ScriptName+" file.ext web_folder[\\remote\\path]"));
 
var shApp = new ActiveXObject('Shell.Application');
 
var curdir = WScript.CreateObject ("WScript.Shell").CurrentDirectory;
var file = shApp.NameSpace(curdir).ParseName(args(0));
var dest = shApp.NameSpace(19 /*ssfNETHOOD*/).ParseName(args(1));
 
if (!dest.IsFolder)
    WScript.Quit(WScript.Echo("No folder: " + args(1)));
 
dest.GetFolder.CopyHere(file);
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License