我的批处理脚本会将文件从一个文件夹复制到另一个文件夹并生成日志。如何修改它以便在日志中显示文件大小和日期修改信息?
@echo off
set path=c:\WINDOWS\system32;
echo Copying started at %date% %time%>>CopyXR222.log
set source=D:\Testing1
set dest=D:\Testing2
echo %source%
echo %dest%
del %dest%\*.* /q
xcopy %source%\222*.csv %dest%\ /s /e >>CopyXR222.log
echo Copying finished at %date% %time%>>CopyXR222.log
echo Completed Successfully at %date% %time%>>CopyXR222.log
echo --------------------------------------------------------------------------- >>CopyXR222.log
pause
答案 0 :(得分:0)
使用robocopy:
robocopy "%source%" "%dest%" *.csv /s /ts /np /njh /njs /nc /ndl /log+:CopyXR222.log /tee
/s
复制子目录,您可以添加/e
以复制所有空目录/ts
添加了时间戳/np /njh /njs /nc /ndl
隐藏0-100%
进度,标题和摘要,“类”,目录列表/log+:CopyXR222.log /tee
附加到日志文件,并在控制台中显示进度