Copy and Rename multple file types using batch file

六月ゝ 毕业季﹏ 提交于 2019-12-13 04:46:51

问题


I want to copy and rename multiple files form Directory A to B. I am looking to add a trimesatmp to each file name copied.

This code succesfully copys form one dir to another without overwriting any doceuments with same filename.

echo N|xcopy /-Y "C:\Users\haematology\Desktop\FolderA" "C:\Users\haematology\Desktop\FolderB"

My timestamp:

for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"

set "datestamp=%YYYY%%MM%%DD%" & set "timestamp=%HH%%Min%%Sec%"
set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%"

So I am looking to rename every file copied to directiroy B by appending the timestamp -

fileName_timestamp.ext

Thansks In Advance

来源:https://stackoverflow.com/questions/33965599/copy-and-rename-multple-file-types-using-batch-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!