{"title":"粘贴文件","inframe":false,"hidden":false,"roles":{"dev":1},"pageLink":"","children":[{"configs":{"serverScript":"var FileUtils = org.apache.commons.io.FileUtils,\n  isCut = app.getBool('isCut'),\n  src = Wb.decode(app.get('src')),\n  dst = new File(app.get('dst')),\n  newDst, isDir, result = [];\nWb.each(src, function(file) {\n  file = new File(file);\n  if (isCut) {\n    FileUtils.moveToDirectory(file, dst, true);\n    newDst = new File(dst, file.getName());\n  } else {\n    //复制文件是如果在同一目录内自动重命名\n    if (file.getParentFile().equals(dst)) {\n      newDst = FileUtil.getUniqueFile(new File(dst, file.getName()));\n      if (file.isDirectory())\n        FileUtils.copyDirectory(file, newDst);\n      else\n        FileUtils.copyFile(file, newDst);\n    } else {\n      if (file.isDirectory())\n        FileUtils.copyDirectoryToDirectory(file, dst);\n      else\n        FileUtils.copyFileToDirectory(file, dst);\n      newDst = new File(dst, file.getName());\n    }\n  }\n  isDir = newDst.isDirectory();\n  result.push({\n    text: newDst.getName(),\n    leaf: !isDir,\n    icon: isDir ? null : WebUtil.encode(FileUtil.getPath(newDst)),\n    type: FileUtil.getFileType(newDst),\n    date: new Date(newDst.lastModified()),\n    size: isDir ? null : newDst.length()\n  });\n});\napp.send(result);","itemId":"module"},"children":[],"type":"module","expanded":false}],"iconCls":""}