本帖最后由 bailong360 于 2016-7-29 09:33 编辑
- (let ((PATH "G:\\test\\"))
- (dolist (dir (directory-files PATH nil "^\[0-9\]+$"))
- (setq n 0)
- (dolist (file (directory-files (concat PATH dir) nil "\[^.\]"))
- (setq n (+ 1 n))
- (let ((oldname (concat PATH dir "\\" file))
- (newname (format "%s%s\\%s_%02d" PATH dir dir n)))
- (rename-file oldname newname)
- (copy-file newname "G:\\newfolder")))))
复制代码 练手党撸一发
顺便吐槽一下directory-files文件目录都列出来是什么鬼?- @echo off
- setlocal enabledelayedexpansion
- ::CODE BY bailong360 @bbs.bathome.net
- for /f "delims=" %%i in ('dir /ad /b "G:\test"') do (
- set n=0
- for /f "delims=" %%j in ('dir /a-d /b "%%i"') do (
- set /a n+=1
- ren "%%i" "%%i\%%~ni_!n!"
- copy "%%i\%%~ni_!n!" "G:\newfolder\"
- )
- )
复制代码
|