/**
* 单笔拷贝本地影像到远程目录
*/
function moveLocalFileToRemote(){
try{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var videoName = localFilePath.substring(localFilePath.lastIndexOf("/") + 1);
if(fso.FileExists(localFilePath)){// 如果本地存在当前录制视频文件,则上传;否则不处理
if(!fso.FolderExists(remoteFilePath)){
newCreateFolder(remoteFilePath);
}
//fso.CopyFile(localFilePath.replace(/\//g,"\\"), remoteFilePath.replace(/\//g,"\\")+ "\\" + videoName);
var command = "xcopy " + localFilePath.replace(/\//g,"\\") + " " + remoteFilePath.replace(/\//g,"\\") + "/y";
var cmd = new ActiveXObject("WScript.Shell");
cmd.run("cmd.exe /c " + command, 0);
cmd = null;
}
} catch (error) {
alert("自动上传面签告警视频失败!");
}
localFilePath = "<%=localPath%>";
remoteFilePath = "<%=savePath%>";
}
/**
* 批量拷贝本地影像到远程目录
*/
function batchMoveLocalFileToRemote(){
try{
var nowDate = new Date().Format("yyyy-MM-dd");
var localPath = "<%=localPath%>" + "/" + nowDate;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var folder = fso.GetFolder(localPath);
var files = new Enumerator(folder.Files);
if(!fso.FolderExists(remoteFilePath)){
newCreateFolder(remoteFilePath);
}
var command = "echo 正在将本地文件上传到共享文件夹,请勿关闭窗口······";
for(; !files.atEnd(); files.moveNext()){
var fileName = files.item().Name;
if(fileName.indexOf("<%=sObjectNo%>") >= 0){
if(!fso.FileExists(remoteFilePath + "/" + fileName)){
//fso.CopyFile(localFilePath.replace(/\//g,"\\"), remoteFilePath.replace(/\//g,"\\")+ "\\" + videoName);
command += " & xcopy " + localPath.replace(/\//g,"\\") + "\\"+ fileName + " " + remoteFilePath.replace(/\//g,"\\") + "/y";
}
}
}
var cmd = new ActiveXObject("WScript.Shell");
cmd.run("cmd.exe /c " + command, 0);
cmd = null;
} catch (error) {
alert("自动上传面签告警视频失败!");
}
localFilePath = "<%=localPath%>";
remoteFilePath = "<%=savePath%>";
}
js复制本地文件(单条和批量)
最新推荐文章于 2025-05-17 12:56:08 发布