create folder first before copy/move #5704
This commit is contained in:
parent
cdab553800
commit
4648dbeb26
|
@ -906,6 +906,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||||
if (common.IsFilenameValid(command.names[i]) === true) {
|
if (common.IsFilenameValid(command.names[i]) === true) {
|
||||||
var s = parent.path.join(scpath, command.names[i]), d = parent.path.join(path, command.names[i]);
|
var s = parent.path.join(scpath, command.names[i]), d = parent.path.join(path, command.names[i]);
|
||||||
sendUpdate = false;
|
sendUpdate = false;
|
||||||
|
try { fs.mkdirSync(path); } catch (ex) { } // try to create folder first incase folder is missing
|
||||||
copyFile(s, d, function (op) { if (op != null) { fs.unlink(op, function (err) { parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); }); } else { parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); } }, ((command.fileop == 'move') ? s : null));
|
copyFile(s, d, function (op) { if (op != null) { fs.unlink(op, function (err) { parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); }); } else { parent.parent.DispatchEvent([user._id], obj, 'updatefiles'); } }, ((command.fileop == 'move') ? s : null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue