找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 667|回复: 0

[每日一码] 在AUTOCAD下实现RoboCopy

[复制链接]

已领礼包: 20个

财富等级: 恭喜发财

发表于 2021-1-16 18:47:56 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
  1. ;;  RoboCopy usage in AutoCAD
  2. ;;  Copyright© 2017 Ron Perez
  3. ;;  Copies files and or folders depending on operating switches used
  4. (defun rjp-robocopy (src_path dest_path filemask switches / _qs rc wss)
  5.   (defun _qs (string) (strcat "\"" (vl-string-right-trim "\\" string) "\" "))
  6.   (or (= 'str (type switches)) (setq switches ""))
  7.   (or (= 'str (type filemask)) (setq filemask "*.*"))
  8.   (and
  9.     (vl-file-directory-p src_path)
  10.     (findfile (setq rc (strcat (getenv "windir") "\\System32\\robocopy.exe ")))
  11.     (setq wss (vlax-get-or-create-object "WScript.Shell"))
  12.     (vlax-invoke-method wss 'run (strcat rc (_qs src_path) (_qs dest_path) filemask " " switches) 0)
  13.     (vlax-release-object wss)
  14.   )
  15. )
  16. ;; Usage - Copies all .exe & .ini files from C:\Windows to c:\rjp-robocopy\test
  17. ;; (rjp-robocopy (getenv "windir") "c:\\rjp-robocopy\\test" "*.exe *.ini" "/MIR")


  18. ;|
  19. -------------------------------------------------------------------------------
  20.    ROBOCOPY     ::     Robust File Copy for Windows
  21. -------------------------------------------------------------------------------




  22.   Started : Thursday, October 26, 2017 12:08:50
  23.               Usage :: ROBOCOPY source destination [file [file]...] [options]




  24.              source :: Source Directory (drive:\path or \\server\share\path).
  25.         destination :: Destination Dir  (drive:\path or \\server\share\path).
  26.                file :: File(s) to copy  (names/wildcards: default is "*.*").




  27. ::
  28. :: Copy options :
  29. ::
  30.                  /S :: copy Subdirectories, but not empty ones.
  31.                  /E :: copy subdirectories, including Empty ones.
  32.              /LEV:n :: only copy the top n LEVels of the source directory tree.




  33.                  /Z :: copy files in restartable mode.
  34.                  /B :: copy files in Backup mode.
  35.                 /ZB :: use restartable mode; if access denied use Backup mode.
  36.                  /J :: copy using unbuffered I/O (recommended for large files).
  37.             /EFSRAW :: copy all encrypted files in EFS RAW mode.




  38.   /COPY:copyflag :: what to COPY for files (default is /COPY:DAT).
  39.                        (copyflags : D=Data, A=Attributes, T=Timestamps).
  40.                        (S=Security=NTFS ACLs, O=Owner info, U=aUditing info).








  41.                /SEC :: copy files with SECurity (equivalent to /COPY:DATS).
  42.            /COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).
  43.             /NOCOPY :: COPY NO file info (useful with /PURGE).
  44.             /SECFIX :: FIX file SECurity on all files, even skipped files.
  45.             /TIMFIX :: FIX file TIMes on all files, even skipped files.




  46.              /PURGE :: delete dest files/dirs that no longer exist in source.
  47.                /MIR :: MIRror a directory tree (equivalent to /E plus /PURGE).




  48.                /MOV :: MOVe files (delete from source after copying).
  49.               /MOVE :: MOVE files AND dirs (delete from source after copying).




  50.      /A+:[RASHCNET] :: add the given Attributes to copied files.
  51.      /A-:[RASHCNET] :: remove the given Attributes from copied files.




  52.             /CREATE :: CREATE directory tree and zero-length files only.
  53.                /FAT :: create destination files using 8.3 FAT file names only.
  54.                /256 :: turn off very long path (> 256 characters) support.




  55.              /MON:n :: MONitor source; run again when more than n changes seen.
  56.              /MOT:m :: MOnitor source; run again in m minutes Time, if changed.




  57.       /RH:hhmm-hhmm :: Run Hours - times when new copies may be started.
  58.                 /PF :: check run hours on a Per File (not per pass) basis.




  59.              /IPG:n :: Inter-Packet Gap (ms), to free bandwidth on slow lines.




  60.                 /SL :: copy symbolic links versus the target.




  61.             /MT[:n] :: Do multi-threaded copies with n threads (default.
  62.                        n must be at least 1 and not greater than 128.
  63.                        This option is incompatible with the /IPG and /EFSRAW options.
  64.                        Redirect output using /LOG option for better performance.




  65. /DCOPY:copyflag :: what to COPY for directories (default is /DCOPY:DA).
  66.                        (copyflags : D=Data, A=Attributes, T=Timestamps).




  67.            /NODCOPY :: COPY NO directory info (by default /DCOPY:DA is done).




  68.          /NOOFFLOAD :: copy files without using the Windows Copy Offload mechanism.




  69. ::
  70. :: File Selection Options :
  71. ::
  72.                  /A :: copy only files with the Archive attribute set.
  73.                  /M :: copy only files with the Archive attribute and reset it.
  74.     /IA:[RASHCNETO] :: Include only files with any of the given Attributes set.
  75.     /XA:[RASHCNETO] :: eXclude files with any of the given Attributes set.




  76. /XF file [file]... :: eXclude Files matching given names/paths/wildcards.
  77. /XD dirs [dirs]... :: eXclude Directories matching given names/paths.




  78.                 /XC :: eXclude Changed files.
  79.                 /XN :: eXclude Newer files.
  80.                 /XO :: eXclude Older files.
  81.                 /XX :: eXclude eXtra files and directories.
  82.                 /XL :: eXclude Lonely files and directories.
  83.                 /IS :: Include Same files.
  84.                 /IT :: Include Tweaked files.




  85.              /MAX:n :: MAXimum file size - exclude files bigger than n bytes.
  86.              /MIN:n :: MINimum file size - exclude files smaller than n bytes.




  87.           /MAXAGE:n :: MAXimum file AGE - exclude files older than n days/date.
  88.           /MINAGE:n :: MINimum file AGE - exclude files newer than n days/date.
  89.           /MAXLAD:n :: MAXimum Last Access Date - exclude files unused since n.
  90.           /MINLAD:n :: MINimum Last Access Date - exclude files used since n.
  91.                        (If n < 1900 then n = n days, else n = YYYYMMDD date).




  92.                 /XJ :: eXclude Junction points. (normally included by default).




  93.                /FFT :: assume FAT File Times (2-second granularity).
  94.                /DST :: compensate for one-hour DST time differences.




  95.                /XJD :: eXclude Junction points for Directories.
  96.                /XJF :: eXclude Junction points for Files.
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-11-15 08:32 , Processed in 0.255790 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表