zoukankan      html  css  js  c++  java
  • 关于 MAXScript 拷贝文件夹及内容到其他位置

      之前用 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))
            
        )
    )-- 将目标目录中的所有文件拷贝到输出目录,如果已存在则不拷贝

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

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

  • 相关阅读:
    python3.5+flask+mysql
    Python魔法师
    Redis
    Socket
    Python线程
    Python全栈之路--Django ORM详解
    基本算法
    Python_Select解析
    如何做好一名DBA【转】
    解决MySQL忘记root密码
  • 原文地址:https://www.cnblogs.com/3dxy/p/4159812.html
Copyright © 2011-2022 走看看