各位先進前輩好!
小弟有一備份批次檔會抓當天日期去建立新資料夾來備份來源端資料夾檔案,
但批次檔目前是先將目的端資料夾全清空後再建立新資料夾開始跑備份,
有點像是刪除後複製的意思,但由於這樣總是要跑很久才會跑完,
因為小檔眾多(約莫3.400萬小檔)每次windows檢索就花不少時間,
所以打算試看看mir鏡像備份試看看是否比較快,
可否在執行鏡像前或後有次檔語法可以改資料夾檔名。
例如:
原先為2024-02-05欲改成2024-02-07
而2/9日那天跑備份時,則為2024-02-07改成2024-02-09
有前輩能指教一二嗎?謝謝。
move <現在的資料夾名稱> <要改成的資料夾名稱>
set today=%date:~0,4%_%date:~5,2%_%date:~8,2%
md %today%
move c:\temp\*.* c:\%today%\
pause
用
ren C:\TEST(<<<要改名的資料夾路徑+名稱) test(新資料夾名稱)
存成.bat就可以批次了
另外目前我用備份批次是做robocopy(差異):
obocopy "來源路徑" "目的路徑" /TEE /E /S /mir /w:2 /R:2
要刪除原檔的話,下一行做刪除原路徑檔案
rmdir /s /q 來源路徑\*.*
move那個應該是搬移吧??
In this batch file, we use the date /t command to get today's date, and then format it into YYYY-MM-DD. Next, we use the ren command to change the name Geometry Dash of the destination folder to today's date. Finally, we use the robocopy command to perform an image backup.