level 1
hnhzlibo
楼主
想将E:\101002\443128198711242018\2017-07-10\客户姓名-身份证号.mp4
拷贝到D:\sp-test\工号_日期_客户姓名-身份证号.mp4
脚本如下,但是提示命令有错误,请教问题出在哪里,谢谢:
@echo off
echo ***********************************************
echo %DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2% %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2% >>log.txt
set SourceFile=D:\source.txt
:源文件夹
set TargetDir=D:\sp-test\
:目标文件夹
pause
setlocal EnableDelayedExpansion
for /f %%s in (%SourceFile%) do ( :s是根目录
echo %%s
pause
for /f "delims=" %%n in ('dir /b %%s') do ( :n为员工代码
for /f "delims=" %%i in ('dir /b %%s%%n') do ( :i是身份证
for /f "delims=" %%d in ('dir /b %%s%%n\%%i') do ( :d是日期
for /f "delims=" %%y in ('dir /b %%s%%n\%%i\%%d') do ( :y是文件名
for /f "delims=" %%a in ('dir /a-d /b %%s%%n\%%i\%%d\%%y| find "-"') do (
for /f "tokens=1 delims=-" %%j in ('dir /b %%a') do (:姓名
for /f "tokens=2 delims=-" %%k in ('dir /b %%a') do (:身份证
set source_file=%%s%%n\%%i\%%d\%%y
set userID=%%n
set date=%%d
set filename=%%y
set custname=%%j
set number=%%k
set target_file=%TargetDir%!userID!_!date!_!custname!-!number!\
copy !source_file! !target_file!
echo 复制 !source_file! 目标 !target_file!>>log.txt
)
)
)
)
)
)
)
)
2017年07月17日 02点07分
1
拷贝到D:\sp-test\工号_日期_客户姓名-身份证号.mp4
脚本如下,但是提示命令有错误,请教问题出在哪里,谢谢:
@echo off
echo ***********************************************
echo %DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2% %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2% >>log.txt
set SourceFile=D:\source.txt
:源文件夹
set TargetDir=D:\sp-test\
:目标文件夹
pause
setlocal EnableDelayedExpansion
for /f %%s in (%SourceFile%) do ( :s是根目录
echo %%s
pause
for /f "delims=" %%n in ('dir /b %%s') do ( :n为员工代码
for /f "delims=" %%i in ('dir /b %%s%%n') do ( :i是身份证
for /f "delims=" %%d in ('dir /b %%s%%n\%%i') do ( :d是日期
for /f "delims=" %%y in ('dir /b %%s%%n\%%i\%%d') do ( :y是文件名
for /f "delims=" %%a in ('dir /a-d /b %%s%%n\%%i\%%d\%%y| find "-"') do (
for /f "tokens=1 delims=-" %%j in ('dir /b %%a') do (:姓名
for /f "tokens=2 delims=-" %%k in ('dir /b %%a') do (:身份证
set source_file=%%s%%n\%%i\%%d\%%y
set userID=%%n
set date=%%d
set filename=%%y
set custname=%%j
set number=%%k
set target_file=%TargetDir%!userID!_!date!_!custname!-!number!\
copy !source_file! !target_file!
echo 复制 !source_file! 目标 !target_file!>>log.txt
)
)
)
)
)
)
)
)