- (defun t1(patha a1 b1)
- (if(vl-file-directory-p patha)
- (foreach x(vl-directory-files patha(strcat"*"a1"*")-1)
- (if(vl-string-search a1 x)
- (vl-file-rename(strcat patha"\\"x)(strcat patha"\\"(vl-string-subst b1 a1 x)))))))
- (defun GetFolder(msg / WinShell shFolder path)
- (setq winshell (vlax-create-object "Shell.Application")
- shFolder (vlax-invoke-method WinShell 'BrowseForFolder 0 msg 1))
- (if (vl-catch-all-error-p(vl-catch-all-apply'(lambda ()(setq shFolder(vlax-get-property shFolder'self))
- (setq path (vlax-get-property shFolder 'path)))))nil path))
- (defun c:t1(/ patha a b)
- (vl-load-com)
- (if(and(setq patha(GetFolder"\n批量修改子文件夹名称"))
- (setq a(getstring"要被替换的字符")b(getstring"替换为")))
- (t1 patha a b)))
|