之前用 hiddenDOSCommand 本机测试通过,但是换其他电脑有时会不能用...

fn xcopy oldfile newfile =
(
    newfilepath = newfile + "\\" + getFilenameFile oldfile
    xcopy_cmd = "xcopy /s /e /i /y " + oldfile + " " + newfilepath-- + " &&rd /s /q " + oldfile
    hiddenDOSCommand (xcopy_cmd as string) startpath:"C:\\"
) -- 复制整个文件夹到指定目录

只能用 MAXScript 完成了...

fn copydir dir n =
(
    dir_array = GetDirectories (dir + "/*")
    for d in dir_array do 
    (
        join dir_array (GetDirectories (d + "/*"))
    )
    copy_files = #()
    append dir_array (dir + "/")
    for f in dir_array do
    (
        join copy_files (getFiles (f + "*"))
    )
    for c in copy_files do
    (
        dir_path = n + (replace (getFilenamePath c) 1 dir.count "")
        makedir dir_path
        copyfile c ( dir_path  + (filenameFromPath c))
        
    )
)-- 将目标目录中的所有文件拷贝到输出目录,如果已存在则不拷贝

先收集所有的子目录,然后逐个收集目录内的文件,再新建目标目录并拷贝文件.

可能方法比较笨...但是暂时能用.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-08
  • 2021-07-25
  • 2021-05-31
  • 2021-11-20
  • 2021-07-19
猜你喜欢
  • 2021-07-25
  • 2021-11-15
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案